%%
%% This is file `listings2.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lstkernel.dtx  (with options: `kernel,info')
%% 
\def\filedate{2009/12/31}
\def\fileversion{2.0beta}
\NeedsTeXFormat{LaTeX2e}
\@ifundefined{eTeXversion}
{\PackageError{Listings}{%
^^J***%
^^J*** Listings \fileversion\space requires e-LaTeX to run. Instead of `latex'
^^J*** or `pdflatex' try `elatex', `pdfelatex', `xelatex', or
^^J*** something similar to your command.
^^J***%
^^J*** The package will not be loaded.
^^J***\@gobble}\@ehc
\endinput}
{}
\AtEndOfPackage{\ProvidesPackage{listings2}
             [\filedate\space\fileversion\space(Carsten Heinz)]}
\def\lst@CheckVersion#1{\edef\reserved@a{#1}%
  \ifx\lst@version\reserved@a \expandafter\@gobble
                        \else \expandafter\@firstofone \fi}
\let\lst@version\fileversion
\def\lst@InputCatcodes{%
  \makeatletter
  \catcode`\"=12\catcode`\:=12\catcode`\-=12%
  \catcode`\^^I=9\catcode`\^^L=9\catcode`\^^M=9%
  \catcode`\%=14\catcode`\~=\active\catcode`\^^@=\active}
\def\lst@RestoreCatcodes#1\catcode#2#3=#4{%
  \catcode#2\noexpand#3=\the\catcode#2#3%
  \ifnum#2#3=\z@\else \expandafter\lst@RestoreCatcodes \fi}
\edef\lst@RestoreCatcodes{%
  \noexpand\let\noexpand\lst@RestoreCatcodes\noexpand\@empty
  \noexpand\lccode`\noexpand\/`\noexpand\/%
  \expandafter\lst@RestoreCatcodes\lst@InputCatcodes}
\lst@InputCatcodes
\AtEndOfPackage{\lst@RestoreCatcodes}
\def\@lst{lst@}
\def\lst@Error{\PackageError{Listings}}
\def\lst@Info#1#2{\ifnum#1<\lstinfolevel\relax \typeout{listings2: #2}\fi}
\@ifundefined{lstinfolevel}{\let\lstinfolevel\z@}{}
\def\lst@GetAllocs{%
  \edef\lst@allocs{%
    0\noexpand\count\the\count10,1\noexpand\dimen\the\count11,%
    2\noexpand\skip\the\count12,3\noexpand\muskip\the\count13,%
    4\noexpand\box\the\count14,5\noexpand\toks\the\count15,%
    6\noexpand\read\the\count16,7\noexpand\write\the\count17}}
\def\lst@ReportAllocs{%
  \lst@Info\tw@{Allocated registers:}\def\lst@temp{\@spaces none}%
  \expandafter\lst@ReportAllocs@\lst@allocs,\z@\relax\z@,}
\def\lst@ReportAllocs@#1#2#3,{%
  \ifx#2\relax
    \ifx\@empty\lst@temp\else \lst@Info\tw@{\lst@temp}\fi
  \else
    \@tempcnta\count1#1\relax \advance\@tempcnta -#3\relax
    \ifnum\@tempcnta=\z@\else
      \let\lst@temp\@empty
      \lst@Info\tw@{\@spaces\the\@tempcnta \string#2}%
    \fi
    \expandafter\lst@ReportAllocs@
  \fi}
\def\lst@ProvideDef#1#2#3{%
  \ifx#1\lst@undefined #2\let#1#3%
     \else\ifx#1\relax #2\let#1#3\fi\fi}
\def\lst@DefOther#1#2{%
  \begingroup
  \def#1{#2}\escapechar\m@ne \@onelevel@sanitize#1
  \expandafter\endgroup\expandafter
  \edef\expandafter#1\expandafter{\expandafter\zap@space#1 \@empty}}
\def\lst@NormedDef#1#2{\lowercase{\edef#1{\zap@space#2 \@empty}}}
\def\lst@NormedNameDef#1#2{%
  \lowercase{\expandafter
  \xdef\csname\zap@space#1 \@empty\endcsname{\zap@space#2 \@empty}}}
\long\def\lst@AddTo#1#2{\expandafter\gdef\expandafter#1\expandafter{#1#2}}
\def\lst@lAddTo#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}
\def\lst@eAddTo#1#2{\expandafter\lst@AddTo\expandafter#1\expandafter{#2}}
\def\lst@elAddTo#1#2{\expandafter\lst@lAddTo\expandafter#1\expandafter{#2}}
\def\lst@AddToAtTop#1{\expandafter\lst@AddToAtTop@\expandafter{#1}#1}
\long\def\lst@AddToAtTop@#1#2#3{\gdef#2{#3#1}}
\def\lst@AddToStackItem{\lst@AddToAtTop\lst@stackitem}
\global\let\lst@stackitem\@empty
\def\lst@SaveToStackItem#1{%
  \expandafter\lst@AddToStackItem\expandafter
      {\expandafter\def\expandafter#1\expandafter{#1}}}
\def\lst@Push#1{%
  \expandafter\lst@AddToAtTop\expandafter#1\expandafter
                             {\lst@stackitem\lst@stackitem}}
\def\lst@Pop#1{%
  \ifx#1\@empty
    \global\let\lst@stackitem\@empty
    \expandafter\lst@GobbleNil
  \fi
  \expandafter\lst@Pop@\expandafter#1#1\@nil}
\def\lst@Pop@#1#2\lst@stackitem#3\@nil{\gdef#1{#3}\gdef\lst@stackitem{#2}}
\def\lst@RemoveFromList#1#2{%
  \expandafter\lst@RemoveFromList@\expandafter#1#2,\relax,}
\def\lst@RemoveFromList@#1#2,{%
  \ifx\relax#2\@empty
    \expandafter\@firstoftwo\expandafter\lst@RemoveCommas
  \else
    \ifx\@empty#2\@empty\else
      \def\lst@temp##1,#2,##2{%
        ##1%
        \ifx\@empty##2\@empty\else
            \expandafter\lst@temp\expandafter,%
        \fi ##2}%
      \edef#1{\expandafter\lst@temp\expandafter,#1,#2,\@empty}%
    \fi
  \fi
  \lst@RemoveFromList@#1}
\def\lst@RemoveCommas#1{\edef#1{\expandafter\lst@RC@#1\@empty}}
\def\lst@RC@#1{\ifx,#1\expandafter\lst@RC@ \else #1\fi}
\def\lst@ReplaceIn#1#2{%
  \expandafter\lst@ReplaceIn@\expandafter#1#2\@nnil\@nnil}
\def\lst@ReplaceIn@#1#2#3{%
  \ifx\@nnil#3\relax
    \expandafter\@gobbletwo
  \else
    \def\lst@temp##1#2##2{%
      \ifx\@nnil##2%
        \lst@lAddTo#1{##1}\expandafter\@gobble
      \else
        \lst@lAddTo#1{##1#3}\expandafter\lst@temp
      \fi ##2}%
    \let\@tempa#1\let#1\@empty
    \expandafter\lst@temp\@tempa#2\@nnil
  \fi
  \lst@ReplaceIn@#1}
\def\lst@RemoveDefFrom#1#2{%
  \def\lst@temp##1\def#2##2##3{%
    \lst@lAddTo#1{##1}%
    \ifx\@empty##3\else \expandafter\lst@temp \fi
    ##3}%
  \let\lst@arg#1\let#1\@empty
  \expandafter\lst@temp\lst@arg\def#2\@empty\@empty}
\def\lst@IfEmptyIntersection#1#2{%
  \bgroup \lst@true
  \lst@for#1\do{\lst@IfOneOf##1\relax#2{\lst@false\lst@forbreak}{}}%
  \lst@if \aftergroup\@firstoftwo \else \aftergroup\@secondoftwo \fi
  \egroup}
\def\lst@IfSubstring#1#2{%
  \def\lst@temp##1#1##2##3\relax{%
    \ifx \@empty##2\expandafter\@secondoftwo
             \else \expandafter\@firstoftwo \fi}%
  \expandafter\lst@temp#2#1\@empty\relax}
\def\lst@IfOneOf#1\relax#2{%
  \def\lst@temp##1,#1,##2##3\relax{%
    \ifx \@empty##2\expandafter\@secondoftwo
             \else \expandafter\@firstoftwo \fi}%
  \expandafter\lst@temp\expandafter,#2,#1,\@empty\relax}
\def\lst@IfNextChars#1#2#3{%
  \def\reserved@a{#2}\def\reserved@b{#3}\let\lst@eaten\@empty
  \lst@IfNextChars@#1\relax}
\def\lst@IfNextChars@#1#2\relax#3{%
  \lst@lAddTo\lst@eaten{#3}%
  \ifnum`#1=`#3%
    \ifx\@empty#2\@empty \let\lst@next\reserved@a
                   \else \def\lst@next{\lst@IfNextChars@#2\relax}\fi
    \expandafter\lst@next
  \else
    \expandafter\reserved@b
  \fi}
\def\lst@IfNextCharEOL#1#2#3{%
  \let\lst@next\@firstoftwo
  \ifnum`#3=\z@\else \ifnum`#3=10\else \ifnum`#3=\active\else
    \let\lst@next\@secondoftwo
  \fi \fi \fi
  \lst@next{#1}{#2}#3}
\def\lst@for#1\do#2{%
  \def\lst@forbody##1,{%
    \ifx \@nnil##1\expandafter\@gobbletwo
             \else\expandafter\@firstofone \fi
    {#2}\lst@forbody}%
  \ifx\@empty#1\@empty\else
    \expandafter\lst@forbody#1,\@nnil,%
  \fi}
\def\lst@forbreak{\def\lst@forbody##1\@nnil,{}}
\def\lst@true{\let\lst@if\iftrue}
\def\lst@false{\let\lst@if\iffalse}
\lst@false
\providecommand*\@gobblethree[3]{}
\def\lst@GobbleNil#1\@nil{}
\def\lst@SetDriverRedirect#1#2#3{%
  \lst@RemoveDriverRedirect#1{#2}%
  \def\lst@temp{[]}\def\lst@arg{#3}
  \ifx\lst@arg\@empty\else \ifx\lst@arg\lst@temp\else
    \lst@NormedDef\lst@arg{,#2>#3}%
    \lst@eAddTo#1\lst@arg
  \fi \fi}
\def\lst@RemoveDriverRedirect#1#2{%
  \lst@ProvideDef#1\global\@empty
  \lst@NormedDef\lst@arg{#2}%
  \expandafter\lst@RemoveDriverRedirect@\expandafter{\lst@arg}#1}
\def\lst@RemoveDriverRedirect@#1#2{%
  \def\lst@temp##1,#1>##2,##3{%
    ##1%
    \ifx##3\@nnil\expandafter\@gobbletwo \else \expandafter\lst@temp \fi
    ,##3}%
  \xdef#2{\expandafter\lst@temp#2,#1>,\@nnil}}
\def\lst@GetDriverRedirect#1#2{%
  \edef\lst@temp{\noexpand\lst@NormedDef\noexpand\lst@temp{#2}}%
  \lst@temp
  \expandafter\lst@GetDriverRedirect@\expandafter{\lst@temp}#1}
\def\lst@GetDriverRedirect@#1#2{%
  \def\lst@temp##1,#1>##2,##3##4\@nil{%
    \ifx##3\@nnil \lst@false \def\lst@redirect{#1}%
            \else \lst@true \def\lst@redirect{##2}\fi}%
  \expandafter\lst@temp#2,#1>,\@nnil\@nil
  \lst@if
    \edef\lst@temp{\noexpand\lst@GetDriverRedirect@{\lst@redirect}%
                                                   \noexpand#2}%
    \expandafter\lst@temp
  \fi}
\def\lst@SetDriverAlias#1{%
  \expandafter\lst@SetAlias@\csname\@lst#1alias\endcsname}
\def\lst@SetAlias@#1{\@ifnextchar[{\lst@SetAlias@s #1}%
                                  {\lst@SetAlias@m #1}}%
\def\lst@SetAlias@s#1[#2]#3[#4]#5{\lst@SetDriverRedirect#1{[#2]#3}{[#4]#5}}
\def\lst@SetAlias@m#1#2#3{\lst@SetDriverRedirect#1{#2}{#3}}
\def\lst@SetDriverDefault#1{%
  \expandafter\lst@SetDriverDefault@\csname\@lst#1alias\endcsname}
\def\lst@SetDriverDefault@#1#2{%
  \lstKV@OArg[]{#2}{\ifx\@empty##1\@empty
                      \lst@RemoveDriverRedirect#1{[]##2}%
                    \else
                      \lst@SetDriverRedirect#1{[]##2}{[##1]##2}%
                    \fi}}
\def\lst@GetDriverAlias#1{%
  \expandafter\lst@GetDriverAlias@\csname\@lst#1alias\endcsname}
\def\lst@GetDriverAlias@#1#2{%
  \lst@ProvideDef#1\global\@empty
  \lstKV@OArg[]{#2}{\lst@NormedDef\lst@arg{##1}%
                    \lst@NormedDef\lst@redirect{##2}}%
  \lst@GetDriverRedirect#1\lst@redirect
  \lst@GetDriverRedirect#1{[\lst@arg]\lst@redirect}}
\def\lst@DefDriver#1#2#3{%
  \let\lst@if#1%
  \@ifnextchar[{\lst@DefDriver@{#2}{#3}}%
               {\lst@DefDriver@{#2}{#3}[]}}
\def\lst@DefDriver@#1#2[#3]#4{%
  \@ifnextchar[{\lst@DefDriver@@{#1}{#2}[#3]{#4}}%
               {\lst@DefDriver@@{#1}{#2}[#3]{#4}[]{}}}
\def\lst@DefDriver@@#1#2[#3]#4{%
  \lst@NormedDef\lst@arg{[#3]#4}%
  \begingroup \lst@setcatcodes
  \expandafter\lst@IfOneOf\lst@arg\relax \lst@require
    {\lst@DefDriver@Def\iftrue}%
    {\lst@DefDriver@Def\lst@if}%
  {#1}{#2}[#3]{#4}}
\def\lst@DefDriver@Def#1#2#3[#4]#5[#6]#7#8{%
  \endgroup
  #1% iftrue|false
    \edef\lst@loaded{\lst@loaded,\lst@arg}%
    \lst@RemoveFromList\lst@require\lst@arg
    \ifx\@empty#6#7\@empty
      \def\lst@next{\lst@DefDriver@Def@#3{}}%
    \else
      \lst@GetDriverAlias{#2}{[#6]#7}%
      \@ifundefined{lst#2@\lst@redirect}%
        {\edef\lst@require{\lst@require,\lst@redirect}}{}%
      \def\lst@next{\lst@DefDriver@Def@#3{also#2=[#6]#7,}}%
    \fi
    \lst@NormedDef\lst@arg{lst#2@[#4]#5}%
    \lst@Info\@ne{storing #2 `[#4]#5' in
                  \expandafter\string\csname\lst@arg\endcsname}%
    \expandafter\lst@next
  \else
    \expandafter\@gobble
  \fi
  {#8}%
  \@ifnextchar[{\lst@DefDriver@Aspects#1}\lst@LoadRequiredCheck}
\def\lst@DefDriver@Aspects#1[#2]{%
  \ifx\@empty#2\@empty\else
    \lst@if
      \lstloadaspects{#2}%
    \else
      #1% iftrue|false
        \lst@NormedDef\lst@temp{#2}%
        \xdef\lst@loadaspects{\lst@loadaspects,\lst@temp}%
      \fi
    \fi
  \fi
  \lst@LoadRequiredCheck}
\def\lst@DefDriver@Def@#1#2#3{\global\@namedef{\lst@arg}{#1{#2#3}}}
\newcommand*\lst@BeginAspect[2][]{%
  \ifx \@empty#2\@empty
    \expandafter\lst@GobbleAspect
  \else
    \lst@NormedDef\lst@arg{#2}%
    \lst@IfEmptyIntersection\lst@arg\lst@require{\lst@false}{\lst@true}%
    \lst@if
      \lst@RemoveFromList\lst@require\lst@arg
      \lst@for\lst@arg\do{\lstKV@OArg[]{##1}%
          {\begingroup
           \ifx\@empty####1\@empty\lst@RequireAspects{#1}%
                            \else \lst@RequireAspects{#1,####2}\fi
           \global\let\@gtempa\lst@require
           \endgroup}%
          \let\lst@require\@gtempa
          \lst@if \def\lst@curraspect{##1}\fi
          \lst@forbreak}%
    \fi
    \lst@if
      \expandafter\lst@IfOneOf\lst@curraspect\relax\lst@loadedaspects
          {\lst@false}{}%
    \fi
    \lst@if
      \let\lst@next\@empty
      \edef\lst@loaded{\lst@loaded,\lst@curraspect}%
      \xdef\lst@loadedaspects{\lst@loadedaspects,\lst@curraspect}%
      \lst@Info\@ne{defining aspect `\lst@curraspect'}\lst@GetAllocs
    \else
      \let\lst@next\lst@GobbleAspect
    \fi
    \expandafter\lst@next
  \fi}
\long\def\lst@GobbleAspect#1\lst@EndAspect{\let\lst@curraspect\@empty}
\global\let\lst@loadedaspects\@empty
\def\lst@EndAspect{%
  \ifcsname lstconfig@\lst@curraspect\endcsname
    \csname lstconfig@\lst@curraspect\endcsname
    \global\expandafter\let\csname lstconfig@\lst@curraspect\endcsname
                           \lst@undefined
  \fi
  \ifcsname lstpatch@\lst@curraspect\endcsname
    \csname lstpatch@\lst@curraspect\endcsname
    \global\expandafter\let\csname lstpatch@\lst@curraspect\endcsname
                           \lst@undefined
  \fi
  \lst@ReportAllocs
  \lst@Info\@ne{Remaining aspects:}%
  \lst@Info\@ne{\@spaces \lst@require}%
  \let\lst@curraspect\@empty
  \lst@LoadRequiredCheck}
\let\lst@UserCommand\gdef
\def\lst@UserCommand#1{\lst@Info\tw@{defining command \string#1,}\gdef#1}
\def\lst@Key#1#2{%
  \lst@Info\tw@{defining key #1}%
  \begingroup
  \def\lst@temp{\lst@Key@{#1}{#2}}%
  \@ifnextchar[{\lstKV@def{#1}{#2}}%
               {\afterassignment\lst@temp
                \global\@namedef{KV@\@lst#1}####1}}
\def\lstKV@def#1#2[#3]{%
  \global\@namedef{KV@\@lst#1@default\expandafter}\expandafter
      {\csname KV@\@lst#1\endcsname{#3}}%
  \afterassignment\lst@temp
  \global\@namedef{KV@\@lst#1}##1}
\def\lst@Key@#1#2{%
  \ifx\relax#2\@empty\else
    \globaldefs\@ne
    \csname KV@\@lst#1\endcsname{#2}%
  \fi
  \endgroup}
\long\def\lst@AddToHook#1{%
  \@ifundefined{lsthk@#1}{%
    \lst@Info\tw@{installing new hook `#1'}%
    \expandafter\gdef\csname lsthk@#1\endcsname{}}{}%
  \expandafter\lst@AddTo\csname lsthk@#1\endcsname}
\def\lst@UseHook#1{\csname lsthk@#1\endcsname}
\def\lst@DefDriverFiles#1#2{%
  \let\lst@arg\@empty
  \lst@for #2\do {\IfFileExists{##1}{\edef\lst@arg{\lst@arg,##1}}{}}%
  \lst@RemoveCommas\lst@arg
  \global\let#1\lst@arg}
\lst@Key{aspectfiles}\relax{\lst@DefDriverFiles\lstaspectfiles{#1}}
\@ifundefined{lstaspectfiles}
{\KV@lst@aspectfiles{lstaspects0.sty,lstaspects.sty}}
{\KV@lst@aspectfiles\lstaspectfiles}
\let\lst@require\@empty
\let\lst@loaded\@empty
\def\lst@RequireAspects#1{%
  \lst@true
  \ifx\@empty#1\@empty\else
    \lst@false
    \edef\lst@arg{\expandafter\zap@space#1 \@empty}%
    \lst@for\lst@arg\do{%
      \ifx\@empty##1\@empty\else
        \lst@IfOneOf##1\relax\lst@loadedaspects
          {}{\edef\lst@require{\lst@require,##1}%
             \lst@true}%
      \fi}%
    \lst@if \lst@LoadRequired{aspects}\lstaspectfiles
      \else \lst@true \fi
  \fi}
\lst@Key{loadaspects}\relax{\lst@RequireAspects{#1}}
\let\lstloadaspects\lst@RequireAspects
\def\lst@RequireDrivers#1#2#3{%
  \ifx\@empty#1\@empty\else
    \lst@false
    \edef\lst@arg{\expandafter\zap@space#2 \@empty}%
    \lst@for\lst@arg\do{%
      \ifx\@empty##1\@empty\else
        \lst@GetDriverAlias{#1}{##1}%
        \@ifundefined{lst#1@\lst@redirect}%
          {\edef\lst@require{\lst@require,\lst@redirect}%
           \lst@true}%
          {}%
      \fi}%
    \lst@if \lst@LoadRequired{#1}#3\fi
  \fi}
\def\lst@SetDriver#1#2#3#4#5{%
  \lst@GetDriverAlias{#1}{#2}%
  \@ifundefined{lst#1@\lst@redirect}%
  {\begingroup
   \let\lst@require\lst@redirect
   \lst@LoadRequired{#1s}{#3}%
   \endgroup}{}%
  \@ifundefined{lst#1@\lst@redirect}%
  {\lst@Error{The #1 \lst@redirect\space is not loadable.}\@ehc}%
  {#4\csname lst#1@\lst@redirect\endcsname #5}}
\def\lst@LoadRequired#1#2{%
  \begingroup
  \lst@Info\z@{trying to load the following #1 from #2}%
  \lst@Info\z@{\@spaces \lst@require}
  \lst@InputCatcodes \let\lst@loaded\relax
  \def\lst@LoadRequiredCheck{%
    \ifx\@empty\lst@require
      \begingroup \catcode`\{9\catcode`\}9\catcode`\^^M\active
      \expandafter\lst@LoadRequiredStop
    \fi}%
  \global\let\lst@loadaspects\@empty
  \lst@LoadRequired@{#2}%
  \ifx\lst@require\@empty\else
    \lst@Info\z@{couldn't load \lst@require}%
  \fi
  \ifx\lst@require\@empty\else
    \lst@Error{Couldn't load all requested #1}%
    {The following #1 weren't loadable:\MessageBreak
     \@spaces\lst@require\MessageBreak
     This may cause errors in the sequel.}%
     \aftergroup\lst@false
  \fi
  \ifx\lst@loadaspects\@empty\else
    \let\lst@require\@empty
    \lst@RequireAspects\lst@loadaspects
    \global\let\lst@loadaspects\@empty
  \fi
  \endgroup
  \let\lst@require\@empty}
\global\let\lst@loadaspects\@empty
\def\lst@LoadRequired@#1{%
  \ifx\lst@require\@empty\else \ifx\lst@loaded\@empty\else
    \let\lst@loaded\@empty
    \lst@for{#1}\do{\InputIfFileExists{##1}{}{}%
                    \ifx\lst@require\@empty \lst@forbreak \fi}%
    \def\lst@next{\lst@LoadRequired@{#1}}%
    \expandafter\expandafter\expandafter\lst@next
  \fi \fi}
\begingroup \lccode`\~=`\^^M\lowercase{\endgroup
\def\lst@LoadRequiredStop#1~}{\endgroup\endinput}%
\let\lst@LoadRequiredCheck\@empty
\def\lstKV@OArg[#1]#2#3{\gdef\@gtempa[##1]##2{#3}\lstKV@OArg@{#1}#2\@}
\def\lstKV@OArg@#1{\@ifnextchar[\lstKV@OArg@@{\lstKV@OArg@@[#1]}}
\def\lstKV@OArg@@[#1]#2\@{\@gtempa[#1]{#2}}
\def\lstKV@XOArg[#1]#2#3{%
  \global\let\@gtempa#3%
  \@ifstar{\lst@false\lstKV@OArg@{#1}}%
          {\lst@true \lstKV@OArg@{#1}}#2\@}
\def\lstKV@SetIf#1{\expandafter\lstKV@SetIf@#1\relax}%
\def\lstKV@SetIf@#1#2\relax#3{\lowercase{\expandafter
  \let\expandafter#3\csname if\ifx #1t}tru\else fals\fi e\endcsname}
\def\lstKV@SwitchCases#1#2#3{%
  \def\@gtempa##1\\#1&##2\\##3##4\@nil{\ifx\@empty##3#3\else ##2\fi}%
  \@gtempa\\#2\\#1&\\\@empty\@nil}
\def\lstKV@CountStars#1{\def\lst@next{#1}\@tempcntb\z@ \lstKV@CountStars@}
\def\lstKV@CountStars@{%
  \@ifstar{\advance\@tempcntb\@ne \lstKV@CountStars@}\lst@next}
\def\lstKV@ReadOArgs#1#2{%
  \lstKV@CountStars{\def\lst@next{#2}\lstKV@ReadOArgs@l#1\@nil}}
\def\lstKV@ReadOArgs@l#1#2\@nil[#3]{%
  \def#1{#3}%
  \ifx\relax#2\relax \expandafter\@gobblethree \fi
  \@ifnextchar[{\lstKV@ReadOArgs@l#2\@nil}%
               \lst@next}
\def\lstKV@ReadArgs#1#2#3{%
  \gdef\lstKV@ReadArgs@l##1##2\relax##3#1{%
    \def##1{##3}%
    \ifx ##1\@nnil
      \let##1\@empty
      \ifx\relax##2\relax
        \global\let\@gtempa\@empty
      \else
        \gdef\@gtempa{\lstKV@ReadArgs@l##2\relax\@nil#1}%
      \fi
    \else
      \ifx\relax##2\relax
        \gdef\@gtempa####1\@nil#1{}%
      \else
        \gdef\@gtempa{\lstKV@ReadArgs@l##2\relax}%
      \fi
    \fi
    \@gtempa}
  \lstKV@ReadArgs@l#2\relax#3#1\@nil#1}
\IfFileExists{xkeyval.sty}{\RequirePackage{xkeyval}[2005/01/30]}
                          {\RequirePackage{keyval}[1997/11/10]}
\lst@GetAllocs
\lst@UserCommand\lstsetup{\begingroup \lst@setcatcodes \lstset@}
\@ifpackageloaded{xkeyval}
{\def\lstset@#1{\endgroup
   \ifx\@empty#1\@empty\else
     \let\lst@stackitem\XKV@rm \lst@Push\lst@XKVrmstack
     \setkeys*{lst}{#1}%
     \ifx\XKV@rm\@empty\else
       \def\lst@Do##1,{%
         \ifx\@nnil##1\@empty\else
           \lst@temp##1=\@nil
           \expandafter\lst@Do
         \fi}%
       \def\lst@temp##1=##2\@nil{##1,}%
       \edef\lst@arg{\expandafter\lst@Do\XKV@rm,\@nnil,}%
       \lst@RequireAspects\lst@arg
       \setrmkeys{lst}\@empty
     \fi
     \lst@Pop\lst@XKVrmstack \let\XKV@rm\lst@stackitem
   \fi}%
   \global\let\lst@XKVrmstack\@empty}
{\def\lstset@#1{\endgroup
   \ifx\@empty#1\@empty\else \setkeys{lst}{#1}\fi}}
\def\lst@setcatcodes{\makeatletter \catcode`==12\catcode`,=12\relax}
\def\lst@Scan#1{%
  \lst@scanifx\lst@scanclass#1\else
    \lst@AddTokenToStream
    \let\lst@recentscanclass\lst@scanclass
    \let\lst@scanclass#1\let\lst@scansubclass\@empty
  \fi
  \futurelet\lst@recentchar\lst@ScanAddCharToToken}
\def\lst@scanlowtrue{\let\lst@scanifx\ifx}
\def\lst@scanlowfalse{\def\lst@scanifx##1##2{\iftrue}}
\lst@scanlowtrue
\def\lst@ResetScanClass{%
  \let\lst@scanclass\lst@scan@ws \let\lst@scansubclass\@empty
  \let\lst@recentscanclass\lst@scan@ws}
\lst@AddToHook{InitScanBOL}{\lst@ResetScanClass}
\def\lst@scan@i{i}
\@namedef{\@lst Scan@\lst@scan@i}{\lst@Scan\lst@scan@i}
\def\lst@scan@o{o}
\@namedef{\@lst Scan@\lst@scan@o}{\lst@Scan\lst@scan@o}
\def\lst@scan@m{m}
\@namedef{\@lst Scan@\lst@scan@m}{\lst@Scan\lst@scan@m}
\def\lst@scan@delimopen{delimopen}
\@namedef{\@lst Scan@\lst@scan@delimopen}{\lst@Scan\lst@scan@delimopen}
\def\lst@scan@delimclose{delimclose}
\@namedef{\@lst Scan@\lst@scan@delimclose}{\lst@Scan\lst@scan@delimclose}
\def\lst@scan@delim{delim}
\@namedef{\@lst Scan@\lst@scan@delim}{%
  \lst@scanifx\lst@scanclass\relax\else
    \lst@AddTokenToStream
    \let\lst@recentscanclass\lst@scanclass
    \let\lst@scanclass\lst@scan@delim \let\lst@scansubclass\@empty
  \fi
  \futurelet\lst@recentchar\lst@ScanAddCharToToken}
\def\lst@scan@n{n}
\@namedef{\@lst Scan@\lst@scan@n}{\lst@Scan\lst@scan@n}
\def\lst@Scan@d{%
  \ifx\lst@scanclass\lst@scan@i
    \expandafter\lst@Scan\expandafter\lst@scan@i
  \else
    \expandafter\lst@Scan\expandafter\lst@scan@n
  \fi}
\def\lst@scan@fpe{fpe}
\def\lst@Scan@fpdot#1#2{%
  \def\lst@next{#1#2}%
  \ifx\lst@scanclass\lst@scan@n
    \ifx\lst@scansubclass\@empty
      \let\lst@scansubclass\relax \def\lst@next{\lst@Scan@n #2}%
    \fi
  \else
    \def\lst@next{\lst@IfNextScan\lst@Scan@d{\lst@Scan@n #2}%
                                            {#1#2}}%
  \fi
  \lst@next}
\def\lst@Scan@fpe#1{%
  \def\lst@next{#1}%
  \ifx\lst@scanclass\lst@scan@n
    \ifx\lst@scansubclass\@empty
      \let\lst@scansubclass\lst@scan@fpe \let\lst@next\lst@Scan@n
    \else \ifx\lst@scansubclass\relax
      \let\lst@scansubclass\lst@scan@fpe \let\lst@next\lst@Scan@n
    \fi \fi
  \fi
  \lst@next}
\def\lst@Scan@fppm#1#2{%
  \ifx\lst@scanclass\lst@scan@n
    \ifx\lst@scansubclass\lst@scan@fpe \def\lst@next{\lst@Scan@n #2}%
                                 \else \def\lst@next{#1#2}\fi
  \else
    \def\lst@next{\lst@IfNextScan\lst@Scan@d{\lst@Scan@n #2}%
                  {\lst@IfNextScan\lst@Scan@fpdot{\lst@Scan@n #2}%
                                                 {#1#2}}}%
  \fi
  \lst@next}
\def\lst@scan@hex{hex}
\def\lst@Scan@hexx#1{%
  \def\lst@next{#1}%
  \ifx\lst@scanclass\lst@scan@n
    \lst@IfToken{0}%
    {\let\lst@scansubclass\lst@scan@hex
     \def\lst@next{\lst@Scan\lst@scan@n}}%
    {}%
  \fi
  \lst@next}
\def\lst@Scan@hexaf#1{%
  \def\lst@next{#1}%
  \ifx\lst@scanclass\lst@scan@n \ifx\lst@scansubclass\lst@scan@hex
    \def\lst@next{\lst@Scan\lst@scan@n}%
  \fi \fi
  \lst@next}
\def\lst@scan@ws{ws}
\def\lst@Scan@space{%
  \lst@scanifx\lst@scanclass\lst@scan@ws\else
    \lst@AddTokenToStream
    \let\lst@recentscanclass\lst@scanclass
    \let\lst@scanclass\lst@scan@ws \let\lst@scansubclass\@empty
  \fi
  \lst@ScanAddCharToToken}
\lst@Key{tabsize}{8}
  {\ifnum#1>\z@ \def\lst@tabsize{#1}\else
     \lst@Error{Strict positive integer expected}%
               {You can't use `#1' as tabsize. \@ehc}%
   \fi}
\def\lst@Scan@tab#1{%
  \lst@scanifx\lst@scanclass\lst@scan@ws\else
    \lst@AddTokenToStream
    \let\lst@recentscanclass\lst@scanclass
    \let\lst@scanclass\lst@scan@ws \let\lst@scansubclass\@empty
  \fi
  \@tempcnta\numexpr \lst@streamlength+\lst@length\relax
  \divide \@tempcnta\lst@tabsize
  \advance\@tempcnta\@ne
  \@tempcnta\numexpr \lst@tabsize*\@tempcnta-\lst@streamlength-\lst@length\relax
  \advance\lst@length\@tempcnta
  \advance\lst@length\m@ne
  \expandafter\lst@ScanAddCharToToken\expandafter{\expandafter
      #1\expandafter\@gobble\expandafter{\the\@tempcnta}}}
\def\lst@ScanUTFviii@ii#1#2{\lst@ScanUTFviii\lst@scan@i#1#2}
\def\lst@ScanUTFviii@iii#1#2#3{\lst@ScanUTFviii\lst@scan@i#1{#2#3}}
\def\lst@ScanUTFviii@iv#1#2#3#4{\lst@ScanUTFviii\lst@scan@i#1{#2#3#4}}
\def\lst@ScanUTFviii#1#2#3{%
  \lst@scanifx\lst@scanclass#1\else
    \lst@AddTokenToStream
    \let\lst@recentscanclass\lst@scanclass
    \let\lst@scanclass#1\let\lst@scansubclass\@empty
  \fi
  \begingroup
    \lst@ResetToken \lst@scanlowfalse \lst@scanhighfalse
    \lst@ScanNextChar#3^^00%
    \xdef\@gtempa{\the\lst@token}\xdef\@gtempa{\@gtempa}%
  \endgroup
  \let\lst@recentchar\@empty
  \expandafter\lst@ScanAddCharToToken\expandafter
      {\expandafter\lst@UTFviii\expandafter{\expandafter#2\@gtempa}}}
\newtoks\lst@token
\newcount\lst@length
\let\lst@extra\@empty
\def\lst@ResetToken{%
  \lst@token{}\lst@length\z@ \let\lst@extra\@empty
  \let\lst@recentchar\@empty}
\lst@AddToHook{InitVarsBOL}{\lst@ResetToken}
\def\lst@AddCharToToken#1{%
  \advance\lst@length\@ne \lst@token=\expandafter{\the\lst@token#1}}
\def\lst@ScanAddCharToToken#1{%
  \advance\lst@length\@ne \lst@token=\expandafter{\the\lst@token#1}%
  \lst@ScanNextChar}
\def\lst@IfToken#1{%
  \def\reserved@a{#1}\edef\reserved@b{\the\lst@token}%
  \ifx\reserved@a\reserved@b \expandafter\@firstoftwo
                       \else \expandafter\@secondoftwo \fi}
\def\lst@ScanToken#1#2{%
  \let\lst@scanclass#1%
  \begingroup
    \lst@scanlowfalse \lst@scanhighfalse
    #2^^@%
    \xdef\@gtempa{\lst@token{\the\lst@token}%
                  \lst@length\the\lst@length\relax}%
  \endgroup
  \@gtempa}
\def\lst@ResetTokenStream{%
  \let\lst@tokenstream\@empty \lst@streamlength\z@}
\lst@AddToHook{InitScanBOL}{\lst@ResetTokenStream}
\newcount\lst@streamlength
\lst@ResetTokenStream
\def\lst@currcolumn{\numexpr\lst@streamlength+\lst@length}
\def\lst@AddTokenToStream{%
  \ifnum\lst@length>\z@
    \lsthk@AddTokenToStream
    \advance\lst@streamlength\lst@length
    \edef\lst@temp{\expandafter\noexpand\csname\@lst Process@\lst@scanclass
                   \endcsname{\the\lst@token}{\the\lst@length}}%
    \lst@elAddTo\lst@temp{\expandafter{\lst@extra}}%
    \expandafter\lst@AddToTokenStream\expandafter{\lst@temp}%
    \lsthk@PostAddTokenToStream
    \global\let\lsthk@PostAddTokenToStream\@empty
    \lst@ResetToken
    \lst@ResetScanClass
  \fi}
\lst@AddToHook{AddTokenToStream}{}% init
\lst@AddToHook{PostAddTokenToStream}{}% init
\def\lst@AddToTokenStream{%
  \lst@ifaddtostream\else \expandafter\@gobblethree \fi
  \lst@lAddTo\lst@tokenstream}
\let\lst@ifaddtostream\iftrue % init
\def\lst@ScanNextChar#1{\csname\@lst CT\number`#1\endcsname}
\let\lst@ScanNextCharScan\lst@ScanNextChar
\def\lst@GetScanChar#1#2{%
  \ifcsname\@lst CT\number`#1\endcsname
    \expandafter\expandafter\expandafter\lst@GetScanChar@
      \csname\@lst CT\number`#1\endcsname\@nil #2%
  \else
    \let#2\relax
  \fi}
\def\lst@GetScanChar@#1#2#3\@nil#4{%
  \ifx\@empty#3\@empty \let#4#2\else \let#4#3\fi}
\let\lst@UM\@empty
\def\lst@UMprint#1{\csname\@lst um#1@\endcsname}
\def\lst@Do#1#2{%
  \ifnum#1>\z@
    \begingroup\lccode`\/=#1\lowercase{\endgroup
    \expandafter\def\csname\@lst um/\endcsname{\lst@UM /}%
    \expandafter\def\csname\@lst um/@\endcsname{#2}}%
    \expandafter\lst@Do
  \fi}
\lst@Do
  {"09}\lst@umtabulator
  {"20}\lst@umspace
  {"23}\#%
  {"24}\textdollar
  {"25}\%%
  {"26}\&%
  {"27}{\lst@nolig\lst@ifupquote \textquotesingle \else \char39\relax \fi}%
  {"2A}{\lst@ttfamily*\textasteriskcentered}%
  {"2C}{\lst@nolig\char`,}%
  {"2D}{\lst@nolig\lst@ttfamily-{$-$}}%
  {"3C}{\lst@nolig\lst@ttfamily<\textless}%
  {"3E}{\lst@nolig\lst@ttfamily>\textgreater}%
  {"5C}{\lst@ttfamily{\char92}\textbackslash}%
  {"5E}\textasciicircum
  {"5F}{\lst@ttfamily{\char95}\textunderscore}%
  {"60}{\lst@nolig\lst@ifupquote \textasciigrave \else \char96\relax \fi}%
  {"7B}{\lst@ttfamily{\char123}\textbraceleft}%
  {"7C}{\lst@ttfamily|\textbar}%
  {"7D}{\lst@ttfamily{\char125}\textbraceright}%
  {"7E}\textasciitilde
  {"7F}-%
  \z@\@empty
\def\lst@nolig{\leavevmode\kern\z@}
\def\lst@ttfamily#1#2{\ifx\f@family\ttdefault #1\relax\else #2\fi}
\lst@AddToHook{Init}{\edef\ttdefault{\ttdefault}}
\lst@Key{upquote}{false}[t]{\lstKV@SetIf{#1}\lst@ifupquote
  \lst@ifupquote
    \@ifundefined{textasciigrave}%
    {\let\KV@lst@upquote\@gobble
     \lstKV@SetIf f\lst@ifupquote \@gobble\fi
     \lst@Error{Option `upquote' requires package `textcomp'}\@eha}%
    {}%
  \fi}
\AtBeginDocument{%
  \@ifpackageloaded{upquote}{\RequirePackage{textcomp}%
                             \lstsetup{upquote}}{}%
  \@ifpackageloaded{upquote2}{\lstsetup{upquote}}{}}
\def\lst@Def#1{\expandafter\def\csname\@lst CT\number#1\endcsname}
\def\lst@Let#1{\expandafter\let\csname\@lst CT\number#1\endcsname}
\def\lst@DefStdChar#1#2{%
  \lst@token{#1}%
  \begingroup\lccode`\/=#2\lowercase{\endgroup
  \edef\lst@arg{{\the\lst@token
                 \ifcsname\@lst um/\endcsname
                   \expandafter\noexpand\csname\@lst um/\endcsname
                 \else
                   /%
                 \fi}}}%
  \global\@namedef{\@lst CT\number#2\expandafter}\lst@arg}
\def\lst@Do#1#2{%
  \ifnum#2=\z@ \expandafter\@gobbletwo \else
    \lst@DefStdChar{#1}{#2}%
  \fi
  \lst@Do{#1}}
\lst@Def{"00}{\@empty}
\lst@Do\lst@Scan@tab{"09}\z@
\lst@Def{"0A}{\lst@MProcessListing}
\lst@Def{"0C}{\lst@ProcessFormFeed}
\lst@Def{"0D}{\lst@MProcessListing}
\lst@Do\lst@Scan@space{"20}\z@
\lst@Do\lst@Scan@o
  {"21}{"2A}{"2B}{"2D}{"2F}{"3C}{"3D}{"3E}\z@ % !*+-/<=>
\lst@Do\lst@Scan@delimopen {"28}{"5B}{"7B}\z@ % ([{
\lst@Do\lst@Scan@delimclose{"29}{"5D}{"7D}\z@ % )]}
\lst@Do\lst@Scan@d % 0123456789
  {"30}{"31}{"32}{"33}{"34}{"35}{"36}{"37}{"38}{"39}%
  \z@
\lst@Do\lst@Scan@m % "#%&',.:;?\^`|~DEL
  {"22}{"23}{"25}{"26}{"27}{"2C}{"2E}{"3A}{"3B}{"3F}%
  {"5C}{"5E}{"60}{"7C}{"7E}{"7F}%
  \z@
\lst@Do{\lst@Scan@fpdot\lst@Scan@m}{"2E}\z@ % .
\lst@Do\lst@Scan@i
  {"24}{"5F}%                               $
  {"40}{"41}{"42}{"43}{"44}{"45}{"46}{"47}% @ABCDEFG
  {"48}{"49}{"4A}{"4B}{"4C}{"4D}{"4E}{"4F}% HIJKLMNO
  {"50}{"51}{"52}{"53}{"54}{"55}{"56}{"57}% PQRSTUVW
  {"58}{"59}{"5A}{"5F}%                     XYZ_
       {"61}{"62}{"63}{"64}{"65}{"66}{"67}%  abcdefg
  {"68}{"69}{"6A}{"6B}{"6C}{"6D}{"6E}{"6F}% hijklmno
  {"70}{"71}{"72}{"73}{"74}{"75}{"76}{"77}% pqrstuvw
  {"78}{"79}{"7A}%                          xyz
  \z@
\def\lst@DefStdCharActive#1#2{%
  \ifnum\catcode#2=\active
    \begingroup\lccode`\~=#2\lccode`\/=#2\lowercase{\endgroup
    \expandafter\lst@DefStdCharActive@~\@empty\@nil~/}{#1}%
  \else
    \begingroup\lccode`\~=#2\lccode`\/=#2\lowercase{\endgroup
    \ifcsname\@lst um/\endcsname
      \global\expandafter\let\csname\@lst um/\endcsname\lst@undefined
    \fi}%
    \lst@DefStdChar{#1}{#2}
  \fi}
\def\lst@DefStdCharActive@#1#2\@nil#3#4#5{%
  \expandafter\gdef\csname\@lst um#4@\endcsname{#3}%
  \expandafter\gdef\csname\@lst um#4\endcsname{\lst@UM #4}%
       \ifx#1\UTFviii@two@octets \lst@DefStdChar\lst@ScanUTFviii@ii{`#4}%
  \else\ifx#1\UTFviii@three@octets \lst@DefStdChar\lst@ScanUTFviii@iii{`#4}%
  \else\ifx#1\UTFviii@four@octets \lst@DefStdChar\lst@ScanUTFviii@iv{`#4}%
  \else \lst@DefStdChar{#5}{`#4}%
  \fi \fi \fi}
\def\lst@UTFviii#1{%
  \ifx\lst@UM\@empty\else \ifx \expandafter#1\unskip \fi \fi
  #1}
\lst@Key{rescanchars}\relax[]{\lst@RescanChars}
\def\lst@RescanChars{%
  \@tempcnta128\relax \@tempcntb256\relax
  \loop \ifnum\@tempcnta<\@tempcntb
    \lst@DefStdCharActive\lst@Scan@i\@tempcnta
    \advance\@tempcnta\@ne
  \repeat
  \xdef\lst@scannedenc{\expandafter\@secondoftwo\@inpenc@undefined}}
\providecommand*\@inpenc@undefined{\@empty\@empty}%
\lst@Key{inputencoding}{}{\def\lst@inputenc{#1}}
\lst@AddToHook{EmptyStyle}{\let\lst@inputenc\@empty}
\AtBeginDocument{%
  \lst@UpdateInputEncoding\iffalse
  \@ifpackageloaded{inputenc}%
  {\lst@AddToHook{Init}{\lst@UpdateInputEncoding\iftrue}}%
  {\let\lst@UpdateInputEncoding\@gobble}%
}
\def\lst@UpdateInputEncoding#1{%
  \edef\lst@option{\expandafter\@secondoftwo\@inpenc@undefined}%
  \ifx\lst@inputenc\@empty
    \ifx\lst@scannedenc\lst@option\else \lst@RescanChars \fi
  \else
    \ifx\lst@inputenc\lst@scannedenc
      #1\inputencoding\lst@inputenc \fi
    \else
      \ifx\lst@inputenc\lst@option
        \lst@RescanChars
      \else
        \inputencoding\lst@inputenc
        \lst@RescanChars
        #1\else\ifx\lst@option\@empty\else \inputencoding\lst@option \fi\fi
      \fi
    \fi
  \fi}
\def\lst@IfNextScan#1#2#3#4{%
  \lst@IfNextCharEOL{#3}%
  {\let\lst@arg#1\def\reserved@a{#2}\def\reserved@b{#3}%
   \expandafter\expandafter\expandafter\lst@IfNextScan@
      \csname\@lst CT\number`#4\endcsname\@empty\@nil}
  #4}
\def\lst@IfNextScan@#1#2\@nil{%
  \ifx\lst@arg#1\@empty \expandafter\reserved@a
                  \else \expandafter\reserved@b \fi}
\def\lst@AddCharClass#1#2{%
  \ifnum`#2>\z@
    \expandafter\expandafter\expandafter\lst@AddCharClass@
        \csname\@lst CT\number`#2\endcsname\@nil{#1}{#2}%
  \else
    \expandafter\@gobbletwo
  \fi
  \lst@AddCharClass{#1}}
\def\lst@AddCharClass@#1#2#3\@nil#4#5{%
  \ifx\@empty#3\@empty
    \lst@lAddTo\lst@adjustcharclass{\lst@Def{`#5}{#4#2}}%
  \else
    \lst@lAddTo\lst@adjustcharclass{\lst@Def{`#5}{#4#3}}%
  \fi}
\let\lst@adjustcharclass\@empty % init
\lst@AddToHook{SetLanguage}{\let\lst@adjustcharclass\@empty}
\lst@Key{charclass}\relax{%
  \let\lst@adjustcharclass\@empty
  \KV@lst@morecharclass{#1}}
\lst@Key{morecharclass}\relax{\lstKV@OArg[m]{#1}{%
  \lstKV@ReadArgs:{\lst@type\lst@arg}{##1}%
  \let\lst@temp\@empty
  \@ifundefined{\@lst Scan@\lst@type}{}%
  {\lst@elAddTo\lst@temp{\csname\@lst Scan@\lst@type\endcsname}%
   \ifx\lst@arg\@empty\else
     \@ifundefined{\@lst Scan@\lst@arg}%
     {\let\lst@temp\@empty}%
     {\lst@elAddTo\lst@temp{\csname\@lst Scan@\lst@arg\endcsname}}%
   \fi}%
  \ifx\lst@temp\@empty
    \lst@Error{Unknown character class `##1'}\@ehc
  \else
    \expandafter\lst@AddCharClass\expandafter{\lst@temp}##2^^00%
  \fi}}
\def\lst@SelectCharTable{%
  \edef\lst@RestoreCatcodes{%
    \catcode`\noexpand\ \the\catcode`\ \catcode`\noexpand\^^M\the\catcode`\^^M%
    \catcode`\noexpand\^^I\the\catcode`\^^I\catcode`\noexpand\%\the\catcode`\%%
    \catcode`\noexpand\\\the\catcode`\\\catcode`\noexpand\{\the\catcode`\{%
    \catcode`\noexpand\}\the\catcode`\}\catcode`\noexpand\#\the\catcode`\#%
    \catcode`\noexpand\^\the\catcode`\^}%
  \obeyspaces\obeylines \catcode`\^^I=12\relax
  \catcode`\%=12\relax \catcode`\\=12\relax
  \catcode`\{=12\relax \catcode`\}=12\relax
  \catcode`\#=12\relax \catcode`\^=12\relax
  \lst@adjustcharclass
  \def\do##1##2##3{##3}\lst@CharTableRedefs
  \lsthk@SelectCharTable
  \lst@DeveloperSCT
  \lst@DefRange}
\lst@AddToHook{SelectCharTable}{}% init
\lst@Key{SelectCharTable}{}{\def\lst@DeveloperSCT{#1}}
\lst@Key{MoreSelectCharTable}\relax{\lst@lAddTo\lst@DeveloperSCT{#1}}
\lst@AddToHook{SetLanguage}{\let\lst@DeveloperSCT\@empty}
\let\lst@CharTableRedefs\@empty
\lst@AddToHook{SetLanguage}{\let\lst@CharTableRedefs\@empty}
\def\lst@RedefDelete#1#2{%
  \begingroup
    \def\reserved@a{#1#2}
    \def\do##1##2##3{\def\reserved@b{##1##2}%
      \ifx\reserved@a\reserved@b\else
        \lst@AddTo\@gtempa{\do##1{##2}{##3}}%
      \fi}%
    \global\let\@gtempa\@empty
    \lst@CharTableRedefs
  \endgroup
  \let\lst@CharTableRedefs\@gtempa}
\def\lst@RedefDeleteClass#1{%
  \begingroup
    \edef\lst@Test{\expandafter\string\csname\@lst #1\endcsname}%
    \expandafter\lst@RedefDeleteClass@\expandafter{\lst@Test}%
    \global\let\@gtempa\@empty
    \lst@CharTableRedefs
  \endgroup
  \let\lst@CharTableRedefs\@gtempa}
\def\lst@RedefDeleteClass@#1{%
  \def\lst@Test##1#1##2\relax{
    \ifx \@empty##1\@empty \expandafter\@firstoftwo
                     \else \expandafter\@secondoftwo \fi}%
  \def\do##1##2##3{%
    \expandafter\lst@Test\string##1#1\relax
    {}%
    {\lst@AddTo\@gtempa{\do##1{##2}{##3}}}}}
\def\lst@RedefInsert#1#2#3{%
  \begingroup
    \def\lst@Test##1#2##2\relax{
      \ifx \@empty##1\@empty \expandafter\@firstoftwo
                       \else \expandafter\@secondoftwo \fi}%
    \def\do##1##2##3{%
      \lst@Test##2#2\relax
      {\lst@AddTo\@gtempa{\do#1{#2}{#3}\do##1{##2}{##3}}%
       \lst@RedefInsert@end}%
      {\lst@AddTo\@gtempa{\do##1{##2}{##3}}}}%
    \global\let\@gtempa\@empty
    \lst@CharTableRedefs\relax
    \lst@AddTo\@gtempa{\do#1{#2}{#3}}%
  \endgroup
  \let\lst@CharTableRedefs\@gtempa}
\def\lst@RedefInsert@end#1\relax{\lst@AddTo\@gtempa{#1}\@gobblethree}
\def\lst@RedefConvert{\@ifnextchar\bgroup\lst@RedefConvertArg\lst@RedefConvert@}
\def\lst@RedefConvertArg#1{%
  {\let\lst@arg\@empty
   \lst@RedefConvert#1\@nnil
   \global\let\@gtempa\lst@arg}%
  \lst@elAddTo\lst@arg{\expandafter{\@gtempa}}%
  \lst@RedefConvert}
\begingroup\lccode`\c=`\,\lowercase{\endgroup
\def\lst@RedefConvert@#1{%
  \ifx\@nnil#1\else
    \ifnum`#1=`\,%
      \lst@lAddTo\lst@arg c%
    \else
      \begingroup\lccode`\/=`#1\lowercase{\endgroup
      \lst@lAddTo\lst@arg/}%
    \fi
    \expandafter\lst@RedefConvert
  \fi}%
}
\def\lst@DefSaveDef#1#2{%
  \expandafter\let\expandafter#2\csname\@lst CT\number#1\endcsname
  \expandafter\def\csname\@lst CT\number#1\endcsname}
\def\lst@LetSaveDef#1#2{%
  \expandafter\let\expandafter#2\csname\@lst CT\number#1\endcsname
  \expandafter\let\csname\@lst CT\number#1\endcsname}
\def\lst@scanhightrue{\lst@amctrue \let\lst@ifscanhigh\iftrue}
\def\lst@scanhighfalse{\lst@amcfalse \let\lst@ifscanhigh\iffalse}
\def\lst@amctrue{\let\lst@ifamc\iftrue}
\def\lst@amcfalse{\let\lst@ifamc\iffalse}
\lst@scanhightrue
\def\lst@CDef#1{\lst@CDef@#1}
\def\lst@CDef@#1#2#3#4{\lst@CDefIt#1{#2}{#3}{#4#2#3}#4}
\def\lst@CDefX#1{\lst@CDefX@#1}
\def\lst@CDefX@#1#2#3{\lst@CDefIt#1{#2}{#3}{}}
\def\lst@CDefIt#1#2#3#4#5#6#7#8{%
  \ifx\@empty#2\@empty
    \lst@Def{`#1}{%
        \lst@ifscanhigh
          #6\def\lst@next{#7#4#8}%
        \else
          \let\lst@next#5%
        \fi
        \lst@next}%
  \else\ifx\@empty#3\@empty
    \lst@Def{`#1}##1{%
        \lst@ifscanhigh
          #6%
          \ifnum`##1=`#2\def\lst@next{#7#4#8}\else
                        \def\lst@next{#5##1}\fi
        \else
          \def\lst@next{#5##1}%
        \fi
        \lst@next}%
  \else
    \lst@Def{`#1}{%
        \lst@ifscanhigh
          #6%
          \def\lst@next{\lst@IfNextChars{#2#3}{#7#4#8}%
                            {\expandafter#5\lst@eaten}}%
        \else
          \let\lst@next#5%
        \fi
        \lst@next}%
  \fi \fi}
\def\lst@CDefAMC#1{\lst@CDefAMC@#1}
\def\lst@CDefAMC@#1#2#3#4{\lst@CDefItAMC#1{#2}{#3}{#4#2#3}#4}
\def\lst@CDefItAMC#1#2#3#4#5#6#7#8{%
  \ifx\@empty#2\@empty
    \lst@Def{`#1}{%
        \def\lst@next{#7#4#8}%
        \lst@ifscanhigh #6\else \lst@ifamc #6\else
          \let\lst@next#5%
        \fi \fi
        \lst@next}%
  \else\ifx\@empty#3\@empty
    \lst@Def{`#1}##1{%
        \ifnum`##1=`#2\def\lst@next{#7#4#8}\else
                      \def\lst@next{#5##1}\fi
        \lst@ifscanhigh #6\else \lst@ifamc #6\else
          \def\lst@next{#5##1}%
        \fi \fi
        \lst@next}%
  \else
    \lst@Def{`#1}{%
        \def\lst@next{\lst@IfNextChars{#2#3}{#7#4#8}%
                          {\expandafter#5\lst@eaten}}%
        \lst@ifscanhigh #6\else \lst@ifamc #6\else
          \let\lst@next#5%
        \fi \fi
        \lst@next}%
  \fi \fi}
\def\lst@CArg#1#2\relax{%
  \lccode`\/=`#1\lowercase{\def\lst@temp{/}}%
  \lst@GetFreeMacro{lstc@\lst@temp}%
  \expandafter\lst@CArg@\lst@freemacro#1#2\@empty\@empty\relax}
\def\lst@CArg@#1#2#3#4\@empty#5\relax#6{%
  \expandafter\let\expandafter#1\csname\@lst CT\number`#2\endcsname
  \ifx\@empty#3\@empty
    \def\lst@next{#6{#2{}{}}}%
  \else
    \def\lst@next{#6{#2#3{#4}}}%
  \fi
  \lst@next #1}
\def\lst@GetFreeMacro#1{%
  \@tempcnta\z@
  \loop \expandafter\unless\expandafter\ifx
          \csname#1\the\@tempcnta\endcsname\relax
    \advance\@tempcnta\@ne
  \repeat
  \edef\lst@freemacro{\csname#1\the\@tempcnta\endcsname}}
\global\let\lst@modestack\@empty
\def\lst@EnterMode#1#2{%
  \xdef\lst@stackitem{\noexpand\lst@mode\the\lst@mode\relax}%
  \lst@mode=#1\relax \csname\@lst modeset\the\lst@mode\endcsname
  #2%
  \lst@Push\lst@modestack
  \lst@ifescape \lst@BeginEscape \fi}
\def\lst@LeaveMode{%
  \ifnum\lst@mode=\lst@nomode\else
    \lst@ifescape \lst@EndEscape \fi
    \ifcsname\@lst modeset\the\lst@mode end\endcsname
      \csname\@lst modeset\the\lst@mode end\endcsname
    \fi
    \lst@Pop\lst@modestack \lst@stackitem
  \fi}
\def\lst@LeaveModeTo#1{%
  \ifnum#1=\lst@mode \expandafter\@gobble \else
    \lst@LeaveMode
    \expandafter\lst@LeaveModeTo
  \fi
  {#1}}
\def\lst@NewModeClass#1#2#3{%
  \ifcsname\@lst if#1\endcsname
    \lst@Error{Mode class `#1' already defined}\@ehd
  \else
    \global\@namedef{\@lst modeset@#1}{\lst@InitModesF}%
    \expandafter\lst@NewModeClass@truefalse
      \csname\@lst if#1\expandafter\endcsname
      \csname\@lst #1true\expandafter\endcsname
      \csname\@lst #1true@\expandafter\endcsname
      \csname\@lst #1false\expandafter\endcsname
      \csname\@lst #1false@\endcsname
    \lst@eAddTo\lst@InitModesT{\csname\@lst #1#2\endcsname}%
    \lst@eAddTo\lst@InitModesF{\csname\@lst #1#3\endcsname}%
  \fi}
\let\lst@InitModesT\@empty % init
\let\lst@InitModesF\@empty % init
\def\lst@NewModeClass@truefalse#1#2#3#4#5{%
  \global\let#1\iffalse
  \gdef#2{#1\else#3\fi}\gdef#4{#1#5\fi}%
  \gdef#3{\lst@AddToStackItem{\global\let#1\iffalse}%
          \global\let#1\iftrue}%
  \gdef#5{\lst@AddToStackItem{\global\let#1\iftrue}%
          \global\let#1\iffalse}}
\def\lst@modeset@{\lst@kernelmodeset}
\lst@Key{initmodes}{true}[t]{\lstKV@SetIf{#1}\lst@if
  \lst@if \def\lst@kernelmodeset{\lst@InitModesT}%
    \else \def\lst@kernelmodeset{\lst@InitModesF}\fi}
\lst@AddToHook{SetLanguage}{\def\lst@kernelmodeset{\lst@InitModesT}}
\def\lst@AddToModeSet#1{%
  \expandafter\lst@AddTo\csname\@lst modeset#1\endcsname}
\lst@NewModeClass@truefalse
  \lst@ifLmode\lst@Lmodetrue\lst@Lmodetrue@
              \lst@Lmodefalse\lst@Lmodefalse@
\lst@AddToHook{InitVars}{\lst@Lmodefalse}
\def\lst@NewMode{\lstKV@CountStars\lst@NewMode@}
\def\lst@NewMode@[#1]#2{%
  \ifcsname\@lst if#1\endcsname
    \xdef\lst@newmode{\the\numexpr \lst@newmode+1}%
    \global\chardef#2\lst@newmode\relax
    \expandafter\xdef\csname\@lst modeset\the#2\endcsname
      {\ifcase\@tempcntb \expandafter\noexpand\csname\@lst modeset@#1\endcsname
       \else
       \fi}%
  \else
    \lst@Error{Unknown mode class `#1'}\@ehd
  \fi}
\def\lst@newmode{\m@ne}% init
\lst@NewMode*[]\lst@nomode
\newcount\lst@mode \lst@mode\lst@nomode
\lst@AddToModeSet{\the\lst@nomode}{%
  \lst@Error{The package entered \string\lst@nomode\space explicitly}\@ehd}
\lst@NewMode[]\lst@Pmode
\def\lst@UseDynamicMode#1[#2]{%
  \ifcsname\@lst if#2s\endcsname\else
    \lst@Error{Unknown mode class `#2'}\@ehc
  \fi
  \edef\lst@dynamicmode{\the\numexpr \lst@dynamicmode+\@ne}%
  \expandafter\edef\csname\@lst modeset\lst@dynamicmode\endcsname
    {\ifcase #1\expandafter\noexpand\csname\@lst modeset@#2s\endcsname
     \else
     \fi}%
  \expandafter\lst@UseDynamicMode@\expandafter{\lst@dynamicmode}}
\def\lst@UseDynamicMode@#1#2{#2{#1}}
\lst@AddToHook{InitVars}{\let\lst@dynamicmode\lst@newmode}
\lst@Key{switchmode}\relax{\lstKV@OArg[]{#1}{%
  \lstKV@ReadArgs:{\lst@arg\lst@type}{##1}%
  \let\lst@error\z@
  \unless\ifcsname\@lst if\lst@arg\endcsname \let\lst@error\@ne\fi
  \unless\ifcsname\@lst if\lst@type\endcsname \let\lst@error\@ne\fi
  \ifx\lst@type\@empty \let\lst@type\lst@arg \let\lst@arg\@empty\fi
  \ifx\lst@type\@empty \let\lst@error\tw@\fi
  \ifnum\lst@error>\z@
    \lst@Error{Unknown or illegal <from> or <to> in `switchmode'}\@eha
  \else
    \expandafter\lst@SwitchMode
      \csname\@lst modeset@\lst@arg\expandafter\endcsname
      \csname\@lst\lst@type true\expandafter\endcsname
      \csname\@lst\lst@type false\expandafter\endcsname
      \csname\@lst restrict@\lst@type\endcsname
    ##2\@nil
  \fi}}
\def\lst@SwitchMode#1#2#3#4{%
  \@ifnextchar[{\lst@SwitchModeArg#1#2#3#4}%
               {\lst@SwitchModeTF#1#2#3#4}}
\def\lst@SwitchModeTF#1#2#3#4#5\@nil{%
  \lst@RemoveDefFrom#1#4%
  \lst@ReplaceIn#1{\@empty#2{}#3{}#4{}}%
  \lstKV@SetIf{#5t}\lst@if
  \lst@if \lst@lAddTo#1#2\else \lst@lAddTo#1#3\fi}
\def\lst@SwitchModeArg#1#2#3#4[#5]#6\@nil{%
  \lstKV@SetIf{#6t}\lst@if
  \lstKV@ReadArgs:{\lst@delim\lst@classes\lst@option}{#5}%
  \ifx\lst@delim\@empty
    \lst@SwitchModeArg@#1#2#3#4%
  \else
    \let\lst@arg\@empty \expandafter\lst@RedefConvert\lst@delim\@nnil
    \expandafter\lst@SwitchModeArg@\csname\@lst modesetdelim@\lst@arg\endcsname
        #2#3#4%
  \fi}
\def\lst@SwitchModeArg@#1#2#3#4{%
  \lst@ProvideDef#1{}\@empty
  \lst@RemoveDefFrom#1#4%
  \lst@ReplaceIn#1{\@empty#2{}#3{}#4{}}%
  \lst@if \lst@lAddTo#1#2\else \lst@lAddTo#1#3\fi
  \ifx#2\lst@escapetrue
    \lst@RemoveDefFrom#1\lst@extra
    \lst@if
              \def\lst@temp{\def\lst@escapebegin}%
      \lst@elAddTo\lst@temp{\expandafter{\lst@classes}%
                            \def\lst@escapeend}%
      \lst@elAddTo\lst@temp{\expandafter{\lst@option}}%
      \lst@elAddTo#1{\expandafter\def\expandafter
                         \lst@extra\expandafter{\lst@temp}}%
    \fi
  \else
    \lst@if
      \ifcsname\@lst\lst@type @data\endcsname
          \lst@SwitchModeList #1%
      \else
        \ifx\lst@classes\@empty\else
          \lst@Error{Class list not allowed with `\lst@type'}\@ehc
        \fi
      \fi
    \fi
  \fi}
\def\lst@RegisterEndDropInputChar#1#2{%
  \lst@LetSaveDef{#1}#2\lst@@EndDropInputChar
  \expandafter\let\csname\@lst EndListingChar\number#1\endcsname}
\def\lst@@EndDropInputChar{\lst@EndDropInputChar}
\def\lst@EndDropInputChar#1#2{\csname\@lst EndListingChar\number`#1\endcsname}
\lst@NewMode*[]\lst@dropinputmode
\lst@AddToModeSet{\the\lst@dropinputmode}{%
  \lst@AddToStackItem{\let\lst@ScanNextChar\lst@ScanNextCharScan
                      \lst@Let{13}\lst@M@saved
                      \lst@Let{10}\lst@J@saved}%
  \let\lst@EndDropInputChar@saved\lst@EndDropInputChar
  \lst@RegisterEndDropInputChar{13}\lst@M@saved\lst@MSkipToFirst
  \lst@RegisterEndDropInputChar{10}\lst@J@saved\lst@MSkipToFirst
  \def\lst@ScanNextChar##1{%
    \expandafter\ifx\csname\@lst CT\number`##1\endcsname\lst@@EndDropInputChar
      \expandafter\lst@EndDropInputChar\expandafter##1%
    \fi
    \lst@ScanNextChar}}
\def\lst@MSkipToFirst{%
  \global\advance\lst@lineno\@ne
  \ifnum \lst@lineno=\lst@firstline
    \lst@LeaveMode
    \lsthk@BeginPart \lsthk@InitVarsBOL \lsthk@InitScanBOL
    \@tempcnta\lst@gobble\relax
    \expandafter\lst@BOLGobble
  \else
    \lsthk@DroppedNewline
    \expandafter\lst@ScanNextChar
  \fi}
\lst@AddToHook{DroppedNewline}{}% init
\def\lst@SkipToFirst{%
  \ifnum \lst@lineno<\lst@firstline
    \lst@EnterMode\lst@dropinputmode{}%
    \expandafter\lst@ScanNextChar
  \else
    \lsthk@BeginPart \lsthk@InitVarsBOL \lsthk@InitScanBOL
    \@tempcnta\lst@gobble\relax
    \expandafter\lst@BOLGobble
  \fi}
\lst@Key{gobble}{0}{\def\lst@gobble{#1}}
\def\lst@BOLGobble{%
  \ifnum\@tempcnta=\z@ \expandafter\lst@ScanNextChar
                 \else \expandafter\lst@BOLGobble@a \fi}
\def\lst@BOLGobble@a#1{%
  \expandafter\expandafter\expandafter\lst@BOLGobble@b
    \csname\@lst CT\number`#1\endcsname\@nnil\@empty#1}
\begingroup\lccode`\/=`\ \lowercase{\endgroup
\gdef\lst@BOLGobble@b#1#2\@empty#3{%
  \def\lst@next{\lst@ScanNextChar#3}%
  \ifx #1\@empty\else
  \ifx #1\lst@MProcessListing\else
  \ifx #1\lst@ProcessFormFeed\else
    \let\lst@next\lst@BOLGobble
    \ifx #1\lst@Scan@tab
      \advance\@tempcnta-\lst@tabsize\relax
      \ifnum\@tempcnta<\z@
        \let\lst@temp\@empty
        \@whilenum\@tempcnta<\z@\do{\edef\lst@temp{\lst@temp/}%
                                    \advance\@tempcnta\@ne}%
        \def\lst@next{\expandafter\lst@ScanNextChar\lst@temp}%
      \fi
    \else
      \ifx #1\relax \lst@Error{Undefined character \number`#3}\@ehd \fi
      \advance\@tempcnta\m@ne
    \fi
  \fi \fi \fi
  \lst@next}%
}
\lst@NewModeClass{escape}{false}{false}
\def\lst@modeset@escape{\lst@InitModesF \lst@escapetrue}
\def\lst@BeginEscape{%
  \lst@modeset@escape
  \def\lst@ScanNextChar{%
    \let\lst@ScanNextChar\lst@ScanNextCharScan
    \def\lst@scanclass{escape}%
    \lst@scanlowfalse
            \def\lst@extra{\def\lst@escapebegin}%
    \lst@elAddTo\lst@extra{\expandafter{\lst@escapebegin}\def\lst@escapeend}%
    \lst@elAddTo\lst@extra{\expandafter{\lst@escapeend}}%
    \lst@ScanNextCharScan}}
\def\lst@EndEscape{%
  \lst@AddTokenToStream \lst@scanlowtrue
  \global\let\lst@ifescape\iffalse}
\def\lst@Process@escape#1#2#3{%
  \lst@OutputWhitespaces
  \begingroup
    \edef\lst@arg{#1}%
    #3%
    \lst@elAddTo\lst@escapebegin{\expandafter{\lst@arg}}%
    \lst@elAddTo\lst@escapebegin\lst@escapeend
    \lst@RestoreCatcodes
    \lst@currstyle{\scantokens\expandafter{\lst@escapebegin}}%
  \endgroup}
\lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}}
\lst@Key{escapeend}{}{\def\lst@escapeend{#1}}
\def\lst@DelimOpen#1#2#3#4#5\@empty{%
  \lst@EnterMode{#3}%
  {\lst@ScanToken\lst@scan@delim{#5}%
   \ifcsname\@lst modesetdelim@\the\lst@token\endcsname
     \csname\@lst modesetdelim@\the\lst@token\expandafter\endcsname
   \fi
   #2%
   #4}%
  #1\lst@AddTokenToStream \else \lst@ResetScanClass\lst@ResetToken \fi
  \lst@ScanNextChar}
\def\lst@DelimClose#1#2\@empty{%
  \lst@ifescape \lst@EndEscape \fi
  #1%
    \lst@ScanToken\lst@scan@delim{#2}%
    \lst@AddTokenToStream
  \fi
  \lst@LeaveMode
  \lst@ScanNextChar}
\def\lst@CArgEmpty#1\@empty{#1}
\def\lst@BeginDelim{\lst@AddTokenToStream \lst@DelimOpen\iftrue{}}
\def\lst@EndDelim{\lst@AddTokenToStream \lst@DelimClose\iftrue}
\def\lst@BeginDelimInvisible{\lst@AddTokenToStream \lst@DelimOpen\iffalse{}}
\def\lst@EndDelimInvisible{\lst@AddTokenToStream \lst@DelimClose\iffalse}
\def\lst@BeginDelimDrop{%
  \lst@AddTokenToStream
  \lst@DelimOpen\iffalse{\lst@escapetrue \let\lst@ifaddtostream\iffalse}}
\def\lst@EndDelimDrop{\lst@DelimClose{\let\lst@ifaddtostream\iftrue \iffalse}}
\def\lst@BeginDelimExclude#1#2#3\@empty{%
  \lst@AddTokenToStream
  \lst@ScanToken\lst@scan@delim{#3}\lst@AddTokenToStream
  \lst@EnterMode{#1}{#2}%
  \lst@ScanNextChar}
\def\lst@EndDelimExclude#1\@empty{%
  \lst@AddTokenToStream
  \lst@ifescape \lst@EndEscape \fi
  \lst@LeaveMode
  #1}
\lst@NewModeClass{delims}{true}{false}
\def\lst@DefDelimB#1#2#3#4{%
  \lst@CDef{#1}#2{#3}%
           {\let\lst@bnext\lst@CArgEmpty #4\lst@bnext}\@empty}
\def\lst@DefDelimE#1#2#3#4{%
  \lst@CDefAMC{#1}#2{#3}%
           {\let\lst@enext\lst@CArgEmpty #4\lst@enext}\@empty}
\lst@AddToHook{Init}{\let\lst@bnext\@empty \let\lst@enext\@empty}
\def\lst@DelimDM@l#1#2\@empty#3#4#5{%
  \lst@CArg #2\relax\lst@DefDelimB{}%
      {\lst@ifdelims \def\lst@bnext{#3{#1}{#5\lst@Lmodetrue}}\fi}}
\def\lst@DelimDM@s#1#2#3\@empty#4#5#6{%
  \lst@CArg #2\relax\lst@DefDelimB{}%
      {\lst@ifdelims \def\lst@bnext{#4{#1}{#6}}\fi}%
  \lst@CArg #3\relax\lst@DefDelimE{}%
      {\ifnum #1=\lst@mode \let\lst@enext#5\fi}}
\lst@Key{delim}\relax{\lst@DelimKey\@empty{#1}}
\lst@Key{moredelim}\relax{\lst@DelimKey\relax{#1}}
\lst@Key{deletedelim}\relax{\lst@DelimKey\@nnil{#1}}
\def\lst@DelimKey#1#2{%
  \lst@Delim{}#2\relax{Delim}#1%
     {\lst@BeginDelim\lst@EndDelim}
    i{\lst@BeginDelimInvisible\lst@EndDelimInvisible}
     {\lst@BeginDelimDrop\lst@EndDelimDrop}}
\def\lst@Delim#1{%
  \def\lst@style{#1}\let\lst@option\@empty
  \lstKV@ReadOArgs{\lst@type\lst@style\lst@option}\lst@Delim@}
\def\lst@Delim@#1\relax#2#3#4#5#6#7{%
  \ifx\lst@style\@empty\else
    \lst@DelimMakeStyleSelect\lst@style
  \fi
  \expandafter\lst@DelimType\lst@type\relax #5{#4}{#6}{#7}%
  \lst@elAddTo\lst@arg{\expandafter{\lst@style}}%
  \let\lst@style\lst@arg
  \ifx #3\@empty \lst@RedefDeleteClass{#2}\fi
  \ifx\@empty#1\@empty
    \ifx #3\@nnil
      \ifcsname\@lst #2DM@\lst@type\endcsname
        \lst@RedefDeleteClass{#2DM@\lst@type}%
      \else
        \lst@RedefDeleteClass{#2@\lst@type}%
      \fi
    \fi
  \else
    \ifcsname\@lst #2DM@\lst@type\endcsname \else
    \ifcsname\@lst #2@\lst@type\endcsname \else
      \begingroup
      \lowercase{\lst@RequireAspects{[\lst@type]#2s}}%
      \endgroup
    \fi \fi
    \ifcsname\@lst #2DM@\lst@type\endcsname
      \lowercase{\edef\lst@delim{\noexpand\lst@UseDynamicMode
                          \ifcase\@tempcntb \z@\or\@ne\or\tw@\else\thr@@\fi
                          [#2]}}%
      \edef\lst@type{\expandafter\noexpand\csname\@lst#2DM@\lst@type\endcsname}%
    \else\ifcsname\@lst #2@\lst@type\endcsname
      \let\lst@delim\@empty
      \edef\lst@type{\expandafter\noexpand\csname\@lst#2@\lst@type\endcsname}%
    \else
      \let\lst@delim\relax
    \fi \fi
    \ifx\lst@delim\relax
      \lst@Error{#2 type `\lst@type' unknown}\@ehc
    \else
      \lst@elAddTo\lst@delim\lst@type
      \ifx\lst@option\@empty\else
        \lst@elAddTo\lst@delim{\expandafter[\lst@option]}%
      \fi
      \let\lst@arg\@empty \lst@RedefConvert#1\@nnil
      \lst@elAddTo\lst@delim\lst@arg
      \lst@elAddTo\lst@delim\lst@style
      \expandafter\lst@Delim@farg\lst@arg\@nil
      \ifx #3\@nnil
        \expandafter\lst@RedefDelete\lst@type
      \else
        \expandafter\expandafter\expandafter\lst@RedefInsert
            \expandafter\lst@type\expandafter{\lst@delim}%
      \fi
    \fi
  \fi}
\def\lst@Delim@farg{%
  \@ifnextchar\bgroup{\lst@true \lst@Delim@farg@}%
                     {\lst@false\lst@Delim@farg@}}
\def\lst@Delim@farg@#1#2\@nil{%
  \lst@if \lst@lAddTo\lst@type{{#1}}%
    \else \lst@lAddTo\lst@type{{#1#2}}\fi}%
\def\lst@DelimType#1\relax#2#3#4#5{%
  \@ifstar{\def\lst@arg{\@empty #5}%
           \@ifnextchar#2{\edef\lst@type{\@gobbletwo#1}\lst@GobbleNil}%
                         {\edef\lst@type{\@gobble#1}\lst@GobbleNil}}%
          {\@ifnextchar#2{\def\lst@arg{\@empty #4}%
                          \edef\lst@type{\@gobble#1}\lst@GobbleNil}%
                         {\def\lst@arg{\@empty #3}%
                          \def\lst@type{#1}\lst@GobbleNil}}%
  #1\@nil}
\def\lst@DelimMakeStyleDef#1{%
  \ifx #1\@empty
    \def#1{\let\lst@extra\@empty}%
  \else
    \expandafter\lst@DelimMakeStyleDef@#1\@nil#1%
  \fi}
\def\lst@DelimMakeStyleDef@#1#2\@nil#3{%
  \if\relax\noexpand#1%
    \expandafter\def\expandafter#3\expandafter{%
        \expandafter\def\expandafter\lst@extra\expandafter{#3}}%
  \else
    \edef#3{\let\noexpand\lst@extra\expandafter\noexpand
                                   \csname\@lst#3\endcsname}%
  \fi}
\def\lst@DelimMakeStyleSelect#1{%
  \lst@DelimMakeStyleDef#1%
  \lst@token\expandafter{#1}%
  \edef#1{\noexpand\lst@ScanSelectStyle
          \ifnum\@tempcntb>\@ne \noexpand\lst@ProcessCumulateStyle
                          \else \noexpand\lst@ProcessSetStyle \fi
          {\the\lst@token}}}
\def\lst@DelimStyle#1#2\@nil{%
  \if\relax\noexpand#1%
    \lst@token\expandafter{\lst@style}%
    \edef\lst@style{\noexpand\lst@ScanSelectStyle
        \ifnum\@tempcntb>\@ne \noexpand\lst@ProcessCumulateStyle
                        \else \noexpand\lst@ProcessSetStyle \fi
        {\def\noexpand\lst@extra{\the\lst@token}}}%
  \else
    \edef\lst@style{\noexpand\lst@ScanSelectStyle
        \ifnum\@tempcntb>\@ne \noexpand\lst@ProcessCumulateStyle
                        \else \noexpand\lst@ProcessSetStyle \fi
        {\let\noexpand\lst@extra\expandafter
                                \noexpand\csname\@lst\lst@style\endcsname}}%
  \fi}
\def\lst@ScanSelectStyle#1#2{%
  \lst@AddToTokenStream{#1{}{}{#2}}%
  \lst@AddToStackItem{\lst@AddToTokenStream{\lst@ProcessPopStyle{}{}{}}}}
\lst@Key{classoffset}\z@{\def\lst@classoffset{#1}}
\def\lst@DefStyle#1#2{\lstKV@OArg[\@ne]{#2}{%
  \@tempcnta \numexpr##1+\lst@classoffset\relax
  \lstKV@CountStars{\expandafter\lst@DefStyle@ul
    \csname\@lst #1\ifnum\@tempcnta=\@ne\else\the\@tempcnta\fi\endcsname}%
  ##2\@nil}}
\def\lst@DefStyle@ul#1#2\@nil{%
  \ifcase\@tempcntb
        \def#1{#2}%
    \or \def#1{\uppercase\expandafter{\expandafter\lst@token
                         \expandafter{\the\lst@token}}#2}%
  \else \def#1{\lowercase\expandafter{\expandafter\lst@token
                         \expandafter{\the\lst@token}}#2}%
  \fi}
\def\lst@InstallFamily#1#2#3#4#5{%
  \lst@Key{#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeKeywords}%
  \lst@Key{more#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeMoreKeywords}%
  \lst@Key{delete#2}\relax{\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}%
  \ifx\@empty#3\@empty\else
    \lst@Key{#3}{#4}{\lst@DefStyle{#3}{##1}}%
  \fi
  \expandafter\lst@InstallFamily@\csname\@lst#2@data\expandafter\endcsname
                                 \csname\@lst#5\endcsname {#1}{#2}{#3}}
\def\lst@InstallFamily@#1#2#3#4#5#6#7{%
  \lst@NewModeClass{#4}{true}{false}%
  \edef\lst@temp{{AddTokenToStream}%
                 {\expandafter\noexpand\csname\@lst if#4\endcsname
                  \expandafter\noexpand\csname lsthk@Detect@#4\endcsname
                  \noexpand\fi}}%
  \expandafter\lst@AddToHook\lst@temp
  \lst@AddToHook{Detect@#4}{}% init
  \gdef#1{{#3}{#4}{#5}#2#7}%
  \long\def\lst@temp##1{#6}%
  \ifx\lst@temp\@gobble
    \global\@namedef{\@lst g#4@wp}##1{%
        \expandafter\let\expandafter\lst@extra
            \csname\@lst#5\ifnum##1=\@ne\else##1\fi\endcsname}%
  \else
    \global\@namedef{\@lst g#4@wp}##1{#6}%
  \fi}
\def\lst@InstallClass#1#2#3#4#5{%
  \lst@Key{#2}\relax{\lst@UseFamily{#2}[1]##1\relax\lst@MakeKeywords}%
  \lst@Key{more#2}\relax{\lst@UseFamily{#2}[1]##1\relax\lst@MakeMoreKeywords}%
  \lst@Key{delete#2}\relax{\lst@UseFamily{#2}[1]##1\relax\lst@DeleteKeywords}%
  \ifx\@empty#3\@empty\else
      \lst@Key{#3}{#4}{\lst@DefStyle{#3}{[1]##1}}%
  \fi
  \expandafter\lst@InstallFamily@\csname\@lst#2@data\expandafter\endcsname
                                 \csname\@lst#5\endcsname {#1}{#2}{#3}}
\def\lst@UseFamily#1{%
  \def\lst@family{#1}%
  \@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}}
\def\lst@UseFamily@[#1]{%
  \@tempcnta\lst@classoffset \advance\@tempcnta#1\relax
  \lst@ProvideClass\lst@family{\the\@tempcnta}%
  \expandafter\lst@UseFamily@b
    \csname\@lst\lst@family\the\@tempcnta @list\expandafter\endcsname
    \csname\@lst\lst@family\the\@tempcnta \expandafter\endcsname
    \csname\@lst\lst@family\the\@tempcnta @also\expandafter\endcsname
    \csname\@lst g\lst@family\the\@tempcnta\endcsname}
\def\lst@UseFamily@b#1#2#3#4#5\relax#6{\lstKV@XOArg[]{#5}#6#1#2#3#4}
\def\lst@MakeKeywords[#1]#2#3#4#5#6{%
  \def#3{#4#6}\let#4\@empty \let#5\@empty
  \lst@MakeMoreKeywords[#1]{#2}#3#4#5#6}
\def\lst@MakeMoreKeywords[#1]#2#3#4#5#6{%
  \lst@BuildClassList#3#1,\relax,%
  \lst@DefKeywordList\lst@temp{#2}%
  \lst@elAddTo#4{\expandafter,\lst@temp}}
\def\lst@BuildClassList#1#2,{%
  \ifx\relax#2\@empty\else
    \ifx\@empty#2\@empty\else
      \lst@elAddTo#1{\csname\@lst #2\expandafter\endcsname
                     \csname\@lst g#2\endcsname}%
    \fi
    \expandafter\lst@BuildClassList\expandafter#1
  \fi}
\def\lst@DefKeywordList#1#2{%
  \let\lst@arg\@empty
  \lst@DefKeywordList@#2\,\@nnil%
  \let#1\lst@arg}
\begingroup \lccode`c=`\,\lowercase{\endgroup
\def\lst@DefKeywordList@#1\,#2{%
  \lst@DefOther\lst@temp{#1}%
  \lst@elAddTo\lst@arg\lst@temp
  \ifx #2\@nnil\else
    \lst@lAddTo\lst@arg{c}%
    \expandafter\lst@DefKeywordList@\expandafter#2%
  \fi}%
}
\def\lst@DeleteKeywords[#1]#2#3#4#5#6{%
  \lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6%
  \lst@DeleteClassesIn#3\@tempa
  \lst@RemoveFromList#4\@tempb}
\def\lst@DeleteClassesIn#1#2{%
  \expandafter\lst@DeleteClassesIn@\expandafter#1#2\@nnil\@nnil}
\def\lst@DeleteClassesIn@#1#2#3{%
  \ifx#2\@nnil \expandafter\@gobbletwo \else
    \def\lst@temp##1#2#3##2{%
      \lst@lAddTo#1{##1}%
      \ifx ##2\@nnil \expandafter\@gobbletwo \fi
      \lst@temp ##2}%
    \let\@tempa#1\let#1\@empty
    \expandafter\lst@temp\@tempa#2#3\@nnil
  \fi
  \lst@DeleteClassesIn@#1}
\def\lst@ProvideClass#1#2{%
  \@ifundefined{lstfam@#1#2}%
  {\global\@namedef{lstfam@#1#2}{}%
   \expandafter\expandafter\expandafter
     \lst@ProvideClass@\csname\@lst#1@data\endcsname{#2}}%
  {}}%
\def\lst@ProvideClass@#1#2#3#4#5#6{%
  \expandafter\xdef\csname\@lst g#2#6@sty\endcsname
  {\expandafter\noexpand\csname\@lst g#2@wp\endcsname{#6}}%
  \ifx\@empty#3\@empty\else
    \edef\lst@temp{{Init}{\noexpand\lst@ProvideDef\expandafter\noexpand
                          \csname\@lst#3\ifnum#6=\@ne\else#6\fi\endcsname
                          {}\noexpand#4}}%
    \expandafter\lst@AddToHook\lst@temp
  \fi
  \expandafter\lst@ProvideClass@@
     \csname\@lst #2#6@list\expandafter\endcsname
     \csname\@lst #2#6\expandafter\endcsname
     \csname\@lst #2#6@also\expandafter\endcsname
     \csname\@lst g#2#6@list\expandafter\endcsname
     \csname\@lst g#2#6\expandafter\endcsname
     \csname\@lst g#2#6@sty\endcsname
     {#1}{#2}#5}
\def\lst@ProvideClass@@#1#2#3#4#5#6#7#8#9{%
  \gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init
  \gdef#4{#2#5}\global\let#5\@empty % init
  \if #9l\relax
    \lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}%
%%TODO    \lst@AddToHook{CompileKV}{\do#1\do#2}%
  \fi
  \lst@InstallTest{#7}#1#2#4#5#6{#8}}
\def\lst@InstallTest#1#2#3#4#5#6#7{%
  \lst@AddToHook{TrackKeywords}{\lst@TrackKeywords{#1}#2#4#6{#7}}%
  \lst@AddToHook{PostTrackKeywords}{\lst@PostTrackKeywords#2#3#4#5}}
\lst@AddToHook{Init}%
  {\global\let\lst@DoDefineKeywords\@empty
   \lsthk@TrackKeywords \lsthk@PostTrackKeywords \lst@DoDefineKeywords
   \global\let\lst@DoDefineKeywords\@empty
   \global\let\lst@ifsensitivedefed\lst@ifsensitive}
\lst@AddToHook{TrackKeywords}{}% init
\lst@AddToHook{PostTrackKeywords}{}% init
\def\lst@TrackKeywords#1#2#3#4#5{%
  \lst@false
  \def\lst@temp{\lst@TK@{#1}#4}%
  \expandafter\lst@temp#2\relax\relax
  \def\lst@temp{\lst@TK@@{#1}#4#2}%
  \expandafter\lst@temp#3\relax\relax
  \lst@if
    \begingroup
    \def\lst@arg{#1}%
    \def\lst@KeywordTest##1{\def\lst@temp{##1}%
                            \ifx\lst@arg\lst@temp \lst@false \fi}%
    \lst@UseHook{Detect@#5}%
    \lst@if \lst@AddToHook{Detect@#5}{\lst@KeywordTest{#1}}\fi
    \endgroup
  \fi}
\def\lst@TK@#1#2#3#4{%
  \ifx\lst@ifsensitive\lst@ifsensitivedefed
    \ifx#3#4\else
      \lst@true
      \lst@UndefineKeywords{#1}#4#2%
      \lst@AddTo\lst@DoDefineKeywords{\lst@DefineKeywords{#1}#3#2}%
    \fi
  \else
    \ifx#3\relax\else
      \lst@true
      \lst@UndefineKeywords{#1}#4#2%
      \lst@AddTo\lst@DoDefineKeywords{\lst@DefineKeywords{#1}#3#2}%
    \fi
  \fi
  \ifx#3\relax
      \expandafter\@gobblethree
  \fi
  \lst@TK@{#1}#2}
\def\lst@TK@@#1#2#3#4#5{%
  \ifx#4\relax
    \expandafter\@gobblefour
  \else
    \lst@IfSubstring{#4#5}#3{}{\lst@UndefineKeywords{#1}#5#2}%
  \fi
  \lst@TK@@{#1}#2#3}
\def\lst@PostTrackKeywords#1#2#3#4{%
  \global\let#3#1%
  \global\let#4#2}
\def\lst@KeywordTest#1{%
  \ifcsname lst#1@\the\lst@token\endcsname
    \csname lst#1@\the\lst@token\endcsname
  \fi}
\def\lst@KEYWORDTEST{%
  \uppercase\expandafter{\expandafter\lst@KEYWORDTEST@\the\lst@token}\relax}
\def\lst@KEYWORDTEST@#1\relax#2{%
  \ifcsname lst#2@#1\endcsname
    \csname lst#2@#1\expandafter\endcsname
  \fi}
\def\lst@DefineKeywords#1#2#3{%
  \lst@ifsensitive
    \def\lst@next{\lst@for#2}%
  \else
    \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
  \fi
  \lst@next\do
  {\expandafter\ifx\csname lst#1@##1\endcsname\relax
      \global\expandafter\let\csname lst#1@##1\endcsname#3%
   \fi}}
\def\lst@UndefineKeywords#1#2#3{%
  \lst@ifsensitivedefed
    \def\lst@next{\lst@for#2}%
  \else
    \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
  \fi
  \lst@next\do
  {\expandafter\ifx\csname lst#1@##1\endcsname#3%
     \global\expandafter\let\csname lst#1@##1\endcsname\lst@undefined
   \fi}}
\lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive}
\lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue}
\global\let\lst@ifsensitive\iftrue % init
\global\let\lst@ifsensitivedefed\iffalse % init % \global
\lst@AddToHook{Init}%
  {\lst@ifsensitive\else
     \let\lst@KeywordTest\lst@KEYWORDTEST
   \fi}
\def\lst@SwitchModeList{%
  \def\lst@temp##1,{%
      \ifx\@empty##1\@empty\else
        \ifx\@nnil##1\expandafter\expandafter\expandafter\@gobble
        \else
          \number\numexpr \lst@classoffset+##1,
        \fi
      \fi
      \lst@temp}%
  \edef\lst@classes{\expandafter\lst@temp\lst@classes,\@nnil,}%
  \expandafter\lst@SwitchModeList@
      \csname\@lst restrict@\lst@type\expandafter\endcsname
      \csname\@lst g\lst@type @wp\expandafter\endcsname
      \csname\@lst g\lst@type @wp@\expandafter\endcsname
      \lst@classes\@nil}
\def\lst@SwitchModeList@#1#2#3#4\@nil#5{
  \lst@RemoveDefFrom#5#1%
  \lst@ReplaceIn#5{\@empty#1{}}%
  \ifx\lst@classes\@empty\else
    \lst@lAddTo#5{\def#1{\let#3#2\lst@AddToStackItem{\let#2#3}%
                         \lst@DefRestrictWP#2#3{#4}}%
                  #1}%
  \fi}
\def\lst@DefRestrictWP#1#2#3{%
  \def#1##1{\def\lst@temp####1,##1,####2####3\relax{%
                \ifx\@empty####2\expandafter\@gobbletwo\fi}%
            \lst@temp,#3,##1,\@empty\relax
            #2{##1}}}
\lst@Key{basewidth}{0.6em,0.45em}{
  \lstKV@ReadArgs,{\lst@widthfixed\lst@widthflexible}{#1}%
  \ifx\lst@widthflexible\@empty
     \let\lst@widthflexible\lst@widthfixed
  \fi
  \let\lst@error\z@
  \ifdim \lst@widthfixed<\z@
     \let\lst@error\@ne \let\lst@widthfixed\z@
  \fi
  \ifdim \lst@widthflexible<\z@
     \let\lst@error\@ne \let\lst@widthflexible\z@
  \fi
  \ifnum\lst@error>\z@
    \lst@Error{Negative value(s) treated as zero}\@ehc
  \fi}
\newdimen\lst@width % global
\lst@Key{fontadjust}{false}[t]{\lstKV@SetIf{#1}\lst@iffontadjust}
\lst@AddToHook{FontAdjust}%
  {\global\lst@width=\lst@ifflexible\lst@widthflexible
                               \else\lst@widthfixed\fi \relax}
\lst@AddToHook{InitVars}{\lsthk@FontAdjust}
\newdimen\lst@lostspace % \global
\lst@AddToHook{InitProcessBOL}{\global\lst@lostspace\z@}
\def\lst@OutputBoxStatic#1{%
  \lst@OutputWhitespaces
  \bgroup
    \lst@OutputBox@}
\def\lst@OutputBoxDynamic#1{%
  \lst@OutputWhitespaces
  \bgroup
    \csname\@lst SetBoxParams\lst@outputalign @#1\endcsname
    \lst@OutputBox@}
\def\lst@OutputBox@#1#2#3{%
    \setbox\@tempboxa\hbox{%
      \lst@token{#1}\lst@length#2%
      \color@begingroup
      #3{\let\lst@UM\lst@UMprint
         \lst@iffontadjust \lsthk@FontAdjust \fi
         \lst@hbox{\lst@lefthss
                   \expandafter\lst@FillOutputBox\the\lst@token\@empty
                   \lst@righthss}}
      \color@endgroup}%
    \lst@CalcLostSpaceAndOutput
  \egroup}
\def\lst@CalcLostSpaceAndOutput{%
  \global\advance\lst@lostspace \lst@length\lst@width
  \global\advance\lst@lostspace-\wd\@tempboxa
  \global\advance\lst@streamlength \lst@length
  \lst@alloverstyle{\ifdim\lst@lostspace>\z@ \lst@leftspace \fi
                    \box\@tempboxa
                    \ifdim\lst@lostspace>\z@ \lst@rightspace \fi}%
  \lsthk@PostOutput}
\lst@AddToHook{PostOutput}{}% init
\let\lst@leftspace\@empty \let\lst@rightspace\@empty % init
\def\lst@alloverstyle#1{#1}% init
\lst@AddToHook{Init}{\global\let\lst@currstyle\relax}
\def\lst@Kern#1{{\lst@currstyle{\kern#1}}}
\def\lst@UseLostSpace{%
  \ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi}
\def\lst@InsertLostSpace{%
  \lst@Kern\lst@lostspace \global\lst@lostspace\z@}
\def\lst@InsertHalfLostSpace{%
  \global\lst@lostspace.5\lst@lostspace
  \lst@Kern\lst@lostspace}
\def\lst@flexibletrue{\let\lst@ifflexible\iftrue}
\def\lst@flexiblefalse{\let\lst@ifflexible\iffalse}
\def\lst@column@fixed{%
  \lst@flexiblefalse
  \lst@width\lst@widthfixed\relax
  \let\lst@OutputLostSpace\lst@UseLostSpace
  \let\lst@WhitespaceLostSpace\lst@UseLostSpace
  \let\lst@FillOutputBox\lst@FillFixed
  \let\lst@hss\hss
  \let\lst@ils\lst@InsertLostSpace
  \let\lst@ihls\lst@InsertHalfLostSpace
  \def\lst@hbox{\hbox to\lst@length\lst@width}}
\def\lst@FillFixed#1{\kern\z@ #1\expandafter\lst@FillFixed@\@empty}
\def\lst@FillFixed@#1{%
  \ifx\@empty#1\else \lst@hss#1\expandafter\lst@FillFixed@ \fi}
\def\lst@column@flexible{%
  \lst@flexibletrue
  \lst@width\lst@widthflexible\relax
  \let\lst@OutputLostSpace\lst@UseLostSpace
  \let\lst@WhitespaceLostSpace\lst@OutputLostSpace
  \let\lst@FillOutputBox\@empty
  \let\lst@hss\@empty
  \let\lst@ils\lst@InsertLostSpace
  \let\lst@ihls\lst@InsertHalfLostSpace
  \let\lst@hbox\hbox}
\def\lst@column@fullflexible{%
  \lst@column@flexible
  \def\lst@OutputLostSpace{\lst@ifBOL \lst@UseLostSpace\fi}%
  \let\lst@WhitespaceLostSpace\lst@OutputLostSpace
  \let\lst@ils\@empty
  \let\lst@ihls\@empty}
\def\lst@column@spaceflexible{%
  \lst@column@fullflexible
  \let\lst@OutputLostSpace\@empty
  \def\lst@WhitespaceLostSpace{%
    \lst@ifBOL \lst@UseLostSpace
         \else \lst@ifshowspaces\else\lst@UseLostSpace\fi \fi}%
}
\def\lst@SetBoxParams@l{%
  \let\lst@lefthss\@empty \def\lst@righthss{\lst@hss}%
  \let\lst@leftspace\@empty \def\lst@rightspace{\lst@ils}}
\def\lst@SetBoxParams@c{%
  \def\lst@lefthss{\lst@hss}\let\lst@righthss\lst@lefthss
  \def\lst@leftspace{\lst@ihls}\def\lst@rightspace{\lst@ils}}
\def\lst@SetBoxParams@r{%
  \def\lst@lefthss{\lst@hss}\let\lst@righthss\@empty
  \def\lst@leftspace{\lst@ils}\let\lst@rightspace\@empty}
\let\lst@SetBoxParamsDynamic@b\lst@SetBoxParams@c
\def\lst@SetBoxParamsDynamic@b@i{%
  \let\lst@lefthss\@empty \let\lst@righthss\@empty
  \let\lst@leftspace\@empty \let\lst@rightspace\@empty}
\let\lst@SetBoxParamsDynamic@b@n\lst@SetBoxParamsDynamic@b@i
\lst@Key{columns}\relax{\lstKV@OArg[b]{#1}{%
  \ifcsname\@lst SetBoxParams@##1\endcsname
    \def\lst@boxparams{\let\lst@OutputBox\lst@OutputBoxStatic
                       \def\lst@outputalign{@##1}}%
  \else
    \ifcsname\@lst SetBoxParamsDynamic@##1\endcsname
      \def\lst@boxparams{\let\lst@OutputBox\lst@OutputBoxDynamic
                         \def\lst@outputalign{Dynamic@##1}}%
    \else
      \PackageWarning{Listings}{Unknown alignment in `columns'}%
      \def\lst@boxparams{\let\lst@OutputBox\lst@OutputBoxDynamic
                         \def\lst@outputalign{Dynamic@b}}%
    \fi
  \fi
  \lst@boxparams
  \csname\@lst SetBoxParams\lst@outputalign\endcsname
  \ifcsname\@lst column@##2\endcsname
    \expandafter\let\expandafter\lst@arg\csname\@lst column@##2\endcsname
    \lst@arg
    \lst@ifflexible \let\lst@columnsflexible\lst@arg
                    \let\lst@boxparamsflexible\lst@boxparams
              \else \let\lst@columnsfixed\lst@arg
                    \let\lst@boxparamsfixed\lst@boxparams \fi
  \else
    \PackageWarning{Listings}{Unknown column format `##2'}%
  \fi}}
\lstsetup{columns=[c]fixed,columns=[c]flexible}
\lst@Key{flexiblecolumns}{true}[t]{%
  \lstKV@SetIf{#1}\lst@ifflexible
  \lst@ifflexible \lst@columnsflexible
                  \let\lst@boxparams\lst@boxparamsflexible
            \else \lst@columnsfixed
                  \let\lst@boxparams\lst@boxparamsfixed \fi}
\def\lst@ProcessTokenStream#1{%
  \lst@AddTokenToStream
  \setbox#1\hbox{\lsthk@ProcessTokenStream
                 \lst@tokenstream\@gobblethree{}{}{}}}
\lst@AddToHook{ProcessTokenStream}{\lsthk@InitVarsBOL \lsthk@InitProcessBOL}
\def\lst@ProcessSetStyle#1#2#3{%
  \lst@ProcessPushStyle{}{}\lst@currstyle
  \begingroup #3\global\let\lst@currstyle\lst@extra \endgroup}
\let\lst@stylestack\@empty
\def\lst@ProcessCumulateStyle#1#2#3{%
  \lst@ProcessPushStyle{}{}\lst@currstyle
  \begingroup
  #3
  \ifx\lst@currstyle\relax \global\let\lst@currstyle\lst@extra
                     \else \lst@eAddTo\lst@currstyle\lst@extra\fi
  \endgroup}
\def\lst@ProcessPushStyle#1#2#3{%
  \lst@OutputWhitespaces
  \ifx#3\relax
    \gdef\lst@stackitem{\global\let#3\relax}%
  \else
    \expandafter\gdef\expandafter\lst@stackitem\expandafter{%
        \expandafter\gdef\expandafter#3\expandafter{#3}}%
  \fi
  \lst@Push\lst@stylestack
  #2}
\def\lst@ProcessPopStyle#1#2#3{%
  \lst@Pop\lst@stylestack
  \lst@stackitem}
\def\lst@ProcessGetNextExtra#1#2#3#4#5#6{%
  \def#1{#6}%
  #2#3{#4}{#5}{#6}}
\def\lst@Process#1#2#3#4#5{%
  \ifx\@empty#5\@empty
    \lst@OutputBox#1{#3}{#4}{#2}%
  \else
    \lst@OutputBox#1{#3}{#4}{#5}%
  \fi}
\def\lst@ProcessWithoutExtra#1#2#3#4#5{\lst@OutputBox#1{#3}{#4}{#2}}
\def\lst@Process@m{\lst@Process\lst@scan@m\lst@currstyle}
\def\lst@Process@n{\lst@Process\lst@scan@n\lst@currstyle}
\def\lst@Process@o{\lst@Process\lst@scan@o\lst@currstyle}
\def\lst@Process@delim{\lst@Process\lst@scan@delim\lst@currstyle}
\def\lst@Process@delimopen{\lst@Process\lst@scan@delimopen\lst@currstyle}
\def\lst@Process@delimclose{\lst@Process\lst@scan@delimclose\lst@currstyle}
\def\lst@Process@i{\lst@Process\lst@scan@i\lst@identifierstyle}
\def\lst@Process@text{\lst@Process\lst@scan@i\lst@currstyle}
\lst@AddToHook{AddTokenToStream}{%
  \ifx\lst@scanclass\lst@scan@i \lst@ifidentifiers\else
    \def\lst@scanclass{text}%
  \fi \fi}
\lst@NewModeClass{identifiers}{true}{false}
\lst@Key{identifierstyle}{}{\def\lst@identifierstyle{#1}}
\lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty}
\def\lst@Process@ws#1#2#3{\lst@token{#1}\lst@length#2\relax}
\lst@AddToHook{InitProcessBOL}%
  {\global\let\lst@lineindent\z@ \global\let\lst@ifBOL\iftrue}
\lst@AddToHook{PostOutput}{\global\let\lst@ifBOL\iffalse}
\global\let\lst@ifBOL\iffalse
\def\lst@OutputWhitespaces{%
  \ifnum\lst@length>\z@
    \expandafter\lst@OutputWhitespaces@\expandafter{\the\lst@token}%
  \fi}
\def\lst@OutputWhitespaces@#1{%
  \setbox\@tempboxa\hbox{%
    \let\lst@OutputLostSpace\lst@WhitespaceLostSpace
    \let\lst@umspace\lst@umProcessSpace
    \lst@ResetToken \let\lst@UM\lst@UMprint
    #1\lst@OutputSpaces
    \lst@OutputLostSpace}%
  \lst@ResetToken
  \lst@ifBOL \xdef\lst@lineindent{\the\wd\@tempboxa}\fi
  \lst@ifbreakremovewhitespace
    \lst@InsertBreakPoint{\box\@tempboxa}%
  \else
    \lst@ifbreakatwhitespace \lst@InsertBreakPoint{}\fi
    \box\@tempboxa
    \lst@InsertBreakPoint{}%
  \fi}
\lst@Key{breakatwhitespace}{false}[t]
  {\lstKV@SetIf{#1}\lst@ifbreakatwhitespace}
\lst@Key{breakremovewhitespace}{false}[t]
  {\lstKV@SetIf{#1}\lst@ifbreakremovewhitespace}
\lst@AddToHook{PostOutput}%
  {\lst@ifbreakatwhitespace\else \lst@InsertBreakPoint{}\fi}
\def\lst@OutputSpaces{%
  \ifnum\lst@length>\z@
    \bgroup
      \edef\lst@arg{{\the\lst@token}{\the\lst@length}}%
      \expandafter\lst@OutputBox@\lst@arg\lst@currstyle
    \lst@ResetToken
  \fi}
\def\lst@umspace{\lst@outputspace}
\def\lst@outputspace{\ }
\def\lst@visiblespace{\lst@ttfamily{\char32}\textvisiblespace}
\lst@Key{showspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifshowspaces}
\lst@Key{keepspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifkeepspaces}
\lst@AddToHook{Init}%
  {\lst@ifshowspaces
     \let\lst@outputspace\lst@visiblespace
     \lst@keepspacestrue
   \fi}
\lst@NewModeClass@truefalse
    \lst@ifkeepspaces
    \lst@keepspacestrue\lst@keepspacestrue@
    \lst@keepspacesfalse\lst@keepspacesfalse@
\lst@Key{showtabs}f[t]{\lstKV@SetIf{#1}\lst@ifshowtabs}
\lst@Key{tab}{\textvisibletabulator}{\def\lst@tab{#1}}
\providecommand*\textvisibletabulator
  {\kern.06em\hbox{\vrule\@height.3ex}\hrulefill\hbox{\vrule\@height.3ex}}
\def\lst@umProcessSpace{%
  \lst@ifkeepspaces
    \lst@AddCharToToken\lst@outputspace
  \else
    \ifnum\lst@length>\z@
      \advance\lst@length\@ne
    \else
      \lst@AddCharToToken\lst@outputspace
    \fi
  \fi}
\def\lst@umtabulator#1#2{%
  \lst@ifshowtabs
    \lst@OutputSpaces
    \@tempcnta#2\relax
    \setbox\@tempboxa\hbox to\@tempcnta\lst@width
        {{\lst@currstyle{\hss\lst@tab}}}%
    \lst@CalcLostSpaceAndOutput
  \else
    \lst@ifkeepspaces
      \@tempcnta#2\relax
      \@whilenum \@tempcnta>\z@ \do
        {\lst@umspace
         \advance\@tempcnta\m@ne}%
    \else
      \lst@umspace
      \advance\lst@length#2\relax
      \advance\lst@length\m@ne
    \fi
  \fi}
\lst@Key{formfeed}{\bigbreak}{\def\lst@formfeed{#1}}
\def\lst@ProcessFormFeed{%
  \lst@OutputTokenStream
  \setbox\@tempboxa\hbox{\vbox{\hsize\lst@colwidth \lst@formfeed}}%
  \lst@AddToPageBox\@tempboxa
  \lsthk@EOL \lsthk@InitVarsBOL \lsthk@InitScanBOL
  \lst@ScanNextChar}
\def\lst@eolistingtrue{\let\lst@ifeolisting\iftrue}
\def\lst@eolistingfalse{\let\lst@ifeolisting\iffalse}
\lst@eolistingfalse
\lst@Key{print}{true}[t]{%
  \lstKV@SetIf{#1}\lst@ifprint
  \let\lst@ifprocessdisplay\lst@ifprint}
\def\lst@OutputTokenStream{%
  \lst@ifprint
    \lst@ProcessTokenStream\@tempboxa
    \lst@ifeolisting
      \lst@OutputEmptyLines
      \lst@ifBOL \ifvoid\lst@pagebox\else \lst@OutputPageBox \fi
           \else \lst@AddToPageBox\@tempboxa \fi
    \else
      \lst@ifBOL
        \global\advance\lst@emptylines\@ne
      \else
        \lst@OutputEmptyLines
        \lst@AddToPageBox\@tempboxa
      \fi
    \fi
  \fi}
\def\lst@AddToPageBox#1{%
  \ifvoid#1%
    \lst@AddToPageBoxOnly#1%
  \else
    \lst@AddToPageBoxOnly#1%
    \lst@ifeolisting
      \lst@OutputPageBox
    \else
      \ifdim \dimexpr \ht\lst@pagebox/\lst@multicols-\dp\strutbox
            >\dimexpr \lst@roomleft\relax
        \lst@OutputPageBox
      \fi
    \fi
  \fi}
\newdimen\lst@maxwidth % \global
\lst@AddToHook{InitDisplay}{\global\lst@maxwidth\z@}
\def\lst@AddToPageBoxOnly#1{%
  \ifdim \wd#1>\lst@maxwidth
    \global\lst@maxwidth \ifdim\lst@colwidth<\wd#1\lst@colwidth\else \wd#1\fi
  \fi
  \global\setbox\lst@pagebox\vbox
    {\hsize \lst@ifbox\lst@maxwidth \else\lst@colwidth \fi
     \ifvoid\lst@pagebox\else
       \@tempdima=\dp\lst@pagebox
       \unvbox\lst@pagebox
       \prevdepth=\@tempdima
     \fi
     \everypar{}\par\noindent
     \lst@ifbreaklines
       \lst@parshape\lsthk@EveryLine\strut\unhbox#1%
     \else
       \lsthk@EveryLine\strut\box#1%
     \fi}}
\newbox\lst@pagebox
\newcount\lst@emptylines
\lst@AddToHook{BeginPart}{\global\lst@emptylines\z@}
\lst@Key{emptylines}\maxdimen{%
  \@ifstar{\lst@true\@tempcnta\@gobble#1\relax\lst@GobbleNil}%
          {\lst@false\@tempcnta#1\relax\lst@GobbleNil}#1\@nil
  \advance\@tempcnta\@ne
  \edef\lst@maxempty{\the\@tempcnta\relax}%
  \let\lst@ifpreservenumber\lst@if}
\lst@AddToHook{DroppedNewline}%
  {\lst@ifpreservenumber \global\advance\c@lstnumber\@ne \fi}
\lst@Key{showlines}f[t]{\lstKV@SetIf{#1}\lst@ifshowlines}
\def\lst@OutputEmptyLines{%
  \lst@ifeolisting \lst@ifshowlines\else \let\lst@maxempty\z@ \fi \fi
  \@whilenum \lst@emptylines>\lst@maxempty \do
  {\lsthk@DroppedNewline \advance\lst@emptylines\m@ne}%
  \global\advance\c@lstnumber-\lst@emptylines
  \@whilenum \lst@emptylines>\z@ \do
  {\lst@ifnumberblanklines\else \ifnum\lst@skipnumbers=\z@
     \global\advance\lst@skipnumbers-\lst@stepnumber\relax
   \fi \fi
   \lst@AddToPageBox\voidb@x
   \global\advance\lst@emptylines\m@ne
   \global\advance\c@lstnumber\@ne}}
\lst@Key{prebreak}{}{\def\lst@prebreak{#1}}
\lst@Key{postbreak}{}{\def\lst@postbreak{#1}}
\lst@Key{breaklines}{false}[t]{\lstKV@SetIf{#1}\lst@ifbreaklines}
\def\lst@InsertBreakPoint{\lst@discretionary}
\lst@AddToHook{InitDisplay}%
  {\lst@ifbreaklines
     \hbadness\@M \pretolerance\@M
     \@rightskip\@flushglue \rightskip\@rightskip % \raggedright
     \leftskip\z@skip \parindent\z@
   \else
     \let\lst@InsertBreakPoint\@firstofone
   \fi}
\def\lst@discretionary#1{%
  \discretionary{\let\space\lst@spacekern \lst@prebreak}%
                {\let\space\lst@spacekern \lst@postbreak}%
                {#1}}
\def\lst@spacekern{\kern\lst@width}
\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }}
\lst@Key{breakindent}{20pt}{\def\lst@breakindent{#1}}
\lst@Key{breakautoindent}{true}[t]{\lstKV@SetIf{#1}\lst@ifbreakautoindent}
\def\lst@parshape{%
  \hangindent\lst@breakindent \hangafter\@ne
  \lst@ifbreakautoindent
    \advance\hangindent\lst@lineindent\relax
  \fi}%
\lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}}
\lst@Key{resetmargins}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins}
\lst@Key{xleftmargin}\z@{\def\lst@xleftmargin{#1}}
\lst@Key{xrightmargin}\z@{\def\lst@xrightmargin{#1}}
\lst@AddToHook{BoxUnsafe}%
  {\let\lst@xleftmargin\z@ \let\lst@xrightmargin\z@}
\lst@AddToHook{InitVarsDisplay}%
  {\edef\lst@linewidth{\the\dimexpr
       \lst@linewidth-\lst@xleftmargin-\lst@xrightmargin
       \lst@ifresetmargins
          +\@totalleftmargin+\rightmargin
       \fi}%
   \lst@ifresetmargins
     \if@inlabel \leavevmode\endgraf \fi
     \@totalleftmargin\z@
   \fi
   \rightskip\z@ \leftskip\z@ \parfillskip=\z@ plus 1fil
   \let\par\@@par}
\lst@Key{lineskip}{\z@}{\lstKV@OArg[\z@]{#1}{%
  \def\lst@parskip{##1}\def\lst@lineskip{##2}}}
\lst@AddToHook{InitDisplay}%
  {\parskip\lst@parskip\relax
   \ifdim\lst@lineskip=\z@\else
     \@tempdima \dimexpr 1pt+(\lst@lineskip*65536/\baselineskip)\relax
     \edef\baselinestretch{\strip@pt\@tempdima}%
     \selectfont
   \fi}
\lst@Key{numbers}{none}{%
  \lstKV@SwitchCases{#1}%
  {none&\let\lst@PlaceNumber\@empty\\%
   left&\def\lst@PlaceNumber{\llap{%
            \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}}\\%
   right&\def\lst@PlaceNumber{\rlap{%
            \kern\lst@colwidth \kern\lst@numbersep
            \lst@numberstyle{\thelstnumber}}}%
  }{\lst@Error{Numbers `#1' unknown}\@eha}}
\lst@Key{numberstyle}{}{\def\lst@numberstyle{#1}}
\lst@Key{numbersep}{10pt}{\def\lst@numbersep{#1}}
\lst@Key{numberblanklines}{true}[t]{\lstKV@SetIf{#1}\lst@ifnumberblanklines}
\lst@Key{numberfirstline}{false}[t]{\lstKV@SetIf{#1}\lst@ifnumberfirstline}
\lst@AddToHook{InitDisplay}{\global\let\lst@ifnumberline\lst@ifnumberfirstline}
\def\lst@numberlinetrue{\global\let\lst@ifnumberline\iftrue}
\def\lst@numberlinefalse{\global\let\lst@ifnumberline\iffalse}
\newcounter{lstnumber}% \global
\global\c@lstnumber\@ne % init
\lst@AddToHook{ProcessTokenStream}{\refstepcounter{lstnumber}}
\renewcommand*\thelstnumber{\@arabic\c@lstnumber}
\AtBeginDocument{%
    \def\theHlstnumber{\ifx\lst@@caption\@empty \lst@neglisting
                                          \else \thelstlisting \fi
                       .\thelstnumber}}
\lst@Key{firstnumber}{auto}{%
  \lstKV@SwitchCases{#1}%
  {auto&\let\lst@firstnumber\lst@undefined\\%
   last&\let\lst@firstnumber\c@lstnumber
  }{\def\lst@firstnumber{#1}}}
\lst@AddToHook{InitVarsDisplay}%
  {\ifx\lst@firstnumber\lst@undefined \def\lst@firstnumber{\lst@lineno}\fi}
\lst@AddToHook{BeginPart}%
  {\global\c@lstnumber\lst@firstnumber
   \global\advance\c@lstnumber\m@ne}
\lst@Key{stepnumber}{1}{%
  \@tempcnta#1\relax
  \ifnum\@tempcnta<\z@ \lst@Error{Illegal value `#1' in stepnumber}\@ehc
                 \else \edef\lst@stepnumber{\the\@tempcnta}\fi}
\lst@AddToHook{EmptyStyle}{\let\lst@stepnumber\@ne}
\newcount\lst@skipnumbers % \global
\lst@AddToHook{BeginPart}
  {\ifnum \lst@stepnumber>\z@
     \global\lst@skipnumbers\lst@firstnumber
     \global\divide\lst@skipnumbers\lst@stepnumber
     \global\multiply\lst@skipnumbers-\lst@stepnumber
     \global\advance\lst@skipnumbers\lst@firstnumber\relax
     \ifnum\lst@skipnumbers>\z@
       \global\advance\lst@skipnumbers-\lst@stepnumber\relax
     \fi
   \else
     \let\lst@PrintLineNumber\@empty
   \fi}
\def\lst@PrintLineNumber{%
  \ifnum\lst@skipnumbers=\z@
    \lst@numberlinetrue
    \global\advance\lst@skipnumbers-\lst@stepnumber\relax
  \fi
  \lst@ifnumberline
    \lst@PlaceNumber
    \lst@numberlinefalse
  \fi
  \global\advance\lst@skipnumbers\@ne}%
\lst@AddToHook{EveryLine}{\lst@PrintLineNumber}%
\lst@Key{multicols}{1}{%
  \@tempcnta=0#1\relax
  \ifnum\@tempcnta>\z@
    \edef\lst@multicols{\the\@tempcnta}%
  \else
    \lst@Error{`#1' not allowed for `multicols'}\@eha
  \fi}
\lst@AddToHook{InitDisplay}%
  {\edef\lst@colwidth{\the\dimexpr
       (\lst@linewidth-\lst@columnsep*\numexpr \lst@multicols-\@ne\relax)
       /\lst@multicols}}
\lst@Key{columnsep}{\columnsep}{\def\lst@columnsep{#1}}
\lst@Key{columnsepleft}{}{\def\lst@columnsepleft{#1}\let\lst@columnsep\@empty}
\lst@Key{columnsepright}{}{\def\lst@columnsepright{#1}\let\lst@columnsep\@empty}
\lst@Key{columnseprule}{\columnseprule}{\def\lst@columnseprule{#1}}
\lst@Key{columnseprulecolor}{}{\def\lst@columnseprulecolor{#1}}
\lst@AddToHook{InitVarsDisplay}%
  {\ifnum\lst@multicols>\@ne
     \ifx\lst@columnsep\@empty
       \ifx\lst@columnsepleft\@empty \let\lst@columnsepleft\z@ \fi
       \ifx\lst@columnsepright\@empty \let\lst@columnsepright\z@ \fi
       \edef\lst@columnsep{\the\dimexpr \lst@columnsepleft+\lst@columnsepright
                                        +\lst@columnseprule}%
     \else
       \edef\lst@columnsepleft{\the\dimexpr
                                   (\lst@columnsep-\lst@columnseprule)/2}%
       \let\lst@columnsepright\lst@columnsepleft
     \fi
   \else
     \let\lst@columnsep\z@
   \fi}
\lst@Key{float}\relax[\lst@floatplacement]{%
  \edef\lst@float{#1}%
  \def\lst@next{\@ifstar{\lst@true\lst@Float}{\lst@false\lst@Float}}%
  \expandafter\lst@next\lst@float\@nil}
\def\lst@Float#1\@nil{%
  \lst@if \let\lst@beginfloat\@dblfloat
          \let\lst@endfloat\end@dblfloat
    \else \let\lst@beginfloat\@float
          \let\lst@endfloat\end@float
  \fi
  \lstKV@SwitchCases{#1}%
  {true&\let\lst@floatdefault\lst@floatplacement
        \let\lst@float\lst@floatdefault\\%
   false&\let\lst@floatdefault\relax
         \let\lst@float\lst@floatdefault
  }{\ifx\@empty#1\@empty \let\lst@float\lst@floatplacement
                   \else \def\lst@float{#1}\fi}}
\lst@AddToHook{PreSet}{\let\lst@float\lst@floatdefault}
\let\lst@floatdefault\relax % init
\lst@Key{floatplacement}{tbp}{\def\lst@floatplacement{#1}}
\AtBeginDocument{%
\@ifundefined{c@float@type}%
    {\edef\ftype@lstlisting{\ifx\c@figure\@undefined 1\else 4\fi}}
    {\edef\ftype@lstlisting{\the\c@float@type}%
     \addtocounter{float@type}{\value{float@type}}}%
}
\def\lst@finalchunktrue{\let\lst@iffinalchunk\iftrue}
\def\lst@finalchunkfalse{\let\lst@iffinalchunk\iffalse}
\lst@finalchunkfalse
\def\lst@OutputPageBox{%
  \lst@BuildFinalListingBox\@tempboxa\z@
  \ifvoid\@tempboxa\else \expandafter\lst@OutputPageBox@ \fi}
\def\lst@OutputPageBox@{%
  \ifx\lst@float\relax\else
    \edef\lst@next{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}%
    \expandafter\lst@next
  \fi
  \vbox{%
    \offinterlineskip
    \box\lst@topbox
    \moveright\if@twoside \ifodd\c@page\lst@xleftmargin\else\lst@xrightmargin\fi
                    \else \lst@xleftmargin \fi
              \box\@tempboxa
    \lst@iffinalchunk \box\lst@finalbox
                \else \box\lst@botbox \fi}%
  \ifx\lst@float\relax
    \ifvoid\lst@pagebox\else \newpage \fi
  \else
    \expandafter\lst@endfloat
  \fi
  \lsthk@EOPUpdate
  \lst@iffinalchunk\else
    \let\lst@next\@empty
    \lst@ifeolisting
      \ifvoid\lst@pagebox
        \PackageWarning{Listings}{Bad page break\on@line}%
      \else
        \lst@BuildFinalListingBox\@tempboxa\z@
        \let\lst@next\lst@OutputPageBox@
      \fi
    \fi
    \expandafter\lst@next
  \fi}
\lst@AddToHook{EOPUpdate}{}% init
\def\lst@BuildFinalListingBox#1#2{%
  \lst@CalcSplitHt{#2}%
  \ifdim \lst@splitht=\z@
    \setbox#1\box\voidb@x
  \else
    \setbox#1=\hbox{%
      \splittopskip=\ht\strutbox \splitmaxdepth\z@ \vbadness=\@M
      \lst@AddDecoration
      \lst@SplitPageBox}%
    \setbox#1=\hbox{%
      \if t\lst@boxpos
        \lower\dimexpr \ht#1-\ht\strutbox\relax
      \else \if b\lst@boxpos
        \raise\dimexpr \dp#1-\dp\strutbox\relax
      \else \if c\lst@boxpos
        \lower\dimexpr (\ht#1-\ht\strutbox+\dp\strutbox)/2\relax
      \fi \fi \fi
      \box#1}%
    \ht#1\dimexpr \ht#1+\ht\lst@topdecorbox\relax
    \dp#1\dimexpr \dp#1+\lst@iffinalchunk \dp\lst@finaldecorbox
                                    \else \dp\lst@botdecorbox \fi \relax
  \fi}
\lst@Key{boxpos}{c}{\def\lst@boxpos{#1}}
\def\lst@SplitPageBox{%
  \vsplit\lst@pagebox to\lst@splitht
  \@tempcnta\lst@multicols\relax
  \@whilenum \@tempcnta>\@ne \do
  {\kern\lst@columnsepright
   \color@begingroup
     \lst@columnseprulecolor \vrule\@width\lst@columnseprule
   \color@endgroup
   \kern\lst@columnsepleft
   \ifvoid\lst@pagebox
     \PackageWarning{Listings}{Empty column in multicolumn listing}%
   \fi
   \vsplit\lst@pagebox to\lst@splitht
   \advance\@tempcnta\m@ne}}
\def\lst@AddDecoration{%
  \setbox\z@=\hbox{%
    \raise\lst@splitht\copy\lst@topdecorbox
    \lst@iffinalchunk
      \copy\lst@finaldecorbox
    \else
      \copy\lst@botdecorbox
    \fi
    \color@begingroup \lst@decoration \color@endgroup}%
  \wd\z@\z@ \dp\z@\z@ \ht\z@\lst@splitht \box\z@}
\newbox\lst@topdecorbox
\newbox\lst@botdecorbox
\newbox\lst@finaldecorbox
\lst@AddToHook{InitVarsDisplay}
  {\setbox\lst@topdecorbox\box\voidb@x
   \setbox\lst@botdecorbox\box\voidb@x
   \setbox\lst@finaldecorbox\box\voidb@x
   \let\lst@decoration\@empty}
\def\lst@CalcSplitHt#1{%
  \@tempdima\dimexpr \ht\lst@pagebox+\dp\lst@pagebox\relax
  \ifnum \lst@multicols>\@ne
    \@tempcnta\numexpr \dimexpr(\@tempdima-\baselineskip)
                               /\baselineskip\relax \relax
    \divide\@tempcnta \lst@multicols\relax
    \@tempdima\dimexpr \@tempcnta\baselineskip+\baselineskip\relax
  \fi
  \lst@splitht\@tempdima
  \@tempdimb\dimexpr \lst@roomleft-\ht\lst@topbox-\dp\lst@topbox
                                  -\ht\lst@topdecorbox-#1\relax
  \ifdim \lst@splitht>\dimexpr \@tempdimb-\ht\lst@finalbox-\dp\lst@finalbox
                                         -\dp\lst@finaldecorbox\relax
    \@tempcnta\numexpr \dimexpr(\@tempdimb-\ht\lst@botbox-\dp\lst@botbox
                                -\dp\lst@botdecorbox-\baselineskip/2*3)
                               /\baselineskip\relax \relax
    \ifnum\@tempcnta<\z@ \@tempcnta\z@ \fi
    \lst@splitht\dimexpr \@tempcnta\baselineskip+\baselineskip\relax
    \ifdim\dimexpr \ht\lst@pagebox+\dp\lst@pagebox<\lst@splitht
      \lst@splitht\dimexpr \ht\lst@pagebox+\dp\lst@pagebox\relax
    \fi
    \lst@finalchunkfalse
  \else
    \lst@finalchunktrue
  \fi
  \advance\lst@splitht\lst@xsplitht\relax
  \lst@adjustsplit
  \ifdim \lst@splitht>\z@
\lst@Info\z@{CalcSplitHt info
^^J current listing:\the\dimexpr\ht\lst@pagebox+\dp\lst@pagebox\relax
^^J pagespace left :\the\dimexpr\lst@roomleft\relax
^^J column split at:\the\lst@splitht}%
  \else
    \newpage \lst@splitht\z@
    \lst@ifeolisting \lst@CalcSplitHt{#1}\fi
  \fi}
\lst@Key{xsplitht}{\z@}{\def\lst@xsplitht{#1}}
\lst@Key{adjustsplit}{}{\def\lst@adjustsplit{#1}}
\newdimen\lst@splitht
\lst@Key{basicstyle}{}{\lstKV@OArg[#1]{#1}{%
  \def\lst@basicstyleinline{##1}\def\lst@basicstyle{##2}}}
\long\def\lst@InsideConvert#1{%
  \begingroup
  \let\do\@makeother \do\^^M\do\^^J\dospecials
  \catcode`\@11\catcode`\\\z@
  \xdef\@gtempa{\expandafter\lst@InsideConvert@loop
                \scantokens{#1\lst@InsideConvert@end}}%
  \endgroup
  \lst@elAddTo\lst@arg\@gtempa}
\begingroup \lccode`\/=`\ \lowercase{\endgroup
\gdef\lst@InsideConvert@loop#1{%
  \ifx#1\lst@InsideConvert@end
    \expandafter\lst@InsideConvert@end
  \else
    \if\relax\noexpand#1%
      \ifcsname\@lst rembs@\string#1\endcsname
        \ifx#1\ /\else \expandafter\@gobble\string#1\fi
      \else
        \expandafter\lst@InsideConvert@testspace\string#1\@nil
      \fi
    \else
      \noexpand#1%
    \fi
    \expandafter\lst@InsideConvert@loop
  \fi}%
}
\def\lst@InsideConvert@testspace#1#2#3\@nil#4\lst@InsideConvert@loop\fi{%
      \fi
    \fi
  \fi
  #1#2#3%
  \ifnum\the\catcode`#2=11 \expandafter\lst@InsideConvert@remspace
                     \else \expandafter\lst@InsideConvert@loop \fi}
\begingroup\lccode`\/=`\ \lowercase{\endgroup
\def\lst@InsideConvert@remspace#1{%
  \if#1/\expandafter\lst@InsideConvert@loop
   \else\expandafter\lst@InsideConvert@loop \expandafter#1\fi}%
}
\def\lst@InsideConvert@end#1{\noexpand}
\@namedef{\@lst rembs@\string\\}{}
\@namedef{\@lst rembs@\string\{}{}
\@namedef{\@lst rembs@\string\}}{}
\@namedef{\@lst rembs@\string\%}{}
\@namedef{\@lst rembs@\string\#}{}
\@namedef{\@lst rembs@\string\ }{}
\def\lst@InitInline{%
  \lsthk@Init \lsthk@InitVars \lst@basicstyleinline
  \lst@EnterMode\lst@Pmode{}%
  \lst@SelectCharTable
  \lsthk@InitVarsBOL\lsthk@InitScanBOL}
\def\lst@DeInitInline{%
  \lst@ProcessTokenStream\@tempboxa \unhbox\@tempboxa
  \lst@LeaveModeTo\lst@nomode}
\newcommand\lstinline[1][]{%
  \leavevmode\bgroup
    \KV@lst@flexiblecolumns{t}\lstsetup{#1}%
    \@ifnextchar\bgroup{\lst@InitInline \catcode`\{\@ne \catcode`\}\tw@
                        \afterassignment\lst@InlineT \lst@token}%
                       {\lst@InitInline \lst@InlineD}}
\lst@AddToHook{PreSet}{}% init
\def\lst@InlineD#1{%
  \def\lst@temp##1#1{\lst@token{##1}\lst@InlineT}%
  \lst@temp}
\def\lst@InlineT{%
  \let\lst@arg\@empty
  \expandafter\lst@InsideConvert\expandafter{\the\lst@token}%
  \lst@token{}%
  \lst@Def{13}{\lst@DeInitInline\egroup
               \lst@Error{lstinline ended by EOL}\@ehc
               \lst@InlineE}%
  \expandafter\lst@ScanNextChar\lst@arg^^@\lst@DeInitInline\egroup}
\def\lst@InlineE#1^^@\lst@DeInitInline\egroup{\scantokens{#1}}
\newcommand\lstMakeShortInline[1][]{\lstMakeShortInline@{\lstinline[#1]}}
\def\lstMakeShortInline@#1#2{%
  \expandafter\ifx\csname lst@ShortInlineOldCatcode\string#2\endcsname\relax
    \lst@shortlstinlineinfo{Made }{#2}%
    \lst@add@special{#2}%
    \expandafter
    \xdef\csname lst@ShortInlineOldCatcode\string#1\endcsname{\the\catcode`#2}%
    \begingroup
      \lccode`\~`#2%
      \lowercase{%
        \global\expandafter\let
          \csname lst@ShortInlineOldMeaning\string#1\endcsname~%
          \expandafter\gdef\expandafter~\expandafter{#1#2}}%
    \endgroup
    \global\catcode`#2\active
  \else
    \lst@Error{\string\lstMakeShorterInline\ definitions cannot be nested}%
              {Use \string\lstDeleteShortInline first.}%
    {}%
  \fi}
\def\lstDeleteShortInline#1{%
  \expandafter\ifx\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax
    \lst@Error{#1 is not a short reference for \string\lstinline}%
              {Use \string\lstMakeShortInline first.}%
    {}%
  \else
    \lst@shortlstinlineinfo{Deleted }{#1 as}%
    \lst@rem@special{#1}%
    \global\catcode`#1\csname lst@ShortInlineOldCatcode\string#1\endcsname
    \global \expandafter\let%
      \csname lst@ShortInlineOldCatcode\string#1\endcsname \relax
    \ifnum\catcode`#1=\active
      \begingroup
        \catcode`\~\active  \lccode`\~`#1%
        \lowercase{%
          \global\expandafter\let\expandafter~%
          \csname lst@ShortInlineOldMeaning\string#1\endcsname}%
      \endgroup
    \fi
  \fi}
\def\lst@shortlstinlineinfo#1#2{%
     \PackageInfo{Listings}{%
       #1\string#2 a short reference for \string\lstinline}}
\def\lst@add@special#1{%
  \lst@rem@special{#1}%
  \lst@AddTo\dospecials{\do #1}%
  \lst@AddTo\@sanitize{\@makeother #1}}
\def\lst@rem@special#1{%
  \def\do##1{%
    \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
  \xdef\dospecials{\dospecials}%
  \begingroup
    \def\@makeother##1{%
      \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
    \xdef\@sanitize{\@sanitize}%
  \endgroup}
\newcount\lst@lineno % \global
\lst@AddToHook{InitDisplay}{\global\lst@lineno\@ne}
\lst@Key{firstline}\relax{\def\lst@firstline{#1\relax}}
\lst@Key{lastline}\relax{\def\lst@lastline{#1\relax}}
\lst@Key{linerange}\relax{\lstKV@OArg[]{#1}{%
  \def\lst@interrange{##1}\def\lst@linerange{##2,}}}
\lst@AddToHook{PreSet}
  {\def\lst@firstline{1}\def\lst@lastline{9999999}%
   \let\lst@linerange\@empty}
\lst@AddToHook{InitDisplay}%
  {\ifx\lst@linerange\@empty
     \edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}%
   \fi
   \lst@GetLineInterval}
\lst@AddToHook{Init}{\global\let\lst@DefRange\@empty}
\begingroup\catcode`\^^M=12\relax%
\gdef\lst@MProcessListing{%
  \lst@AddTokenToStream%
  \lst@ifLmode \lst@LeaveMode \fi%
  \lst@ifescape%
    \lst@AddCharToToken{^^M}%
    \lst@streamlength-\lst@length% TODO: move it to hook?
    \lsthk@DroppedNewline%
  \else%
    \lst@OutputTokenStream%
    \lsthk@EOL \lsthk@InitVarsBOL \lsthk@InitScanBOL%
  \fi%
  \global\advance\lst@lineno\@ne%
  \ifnum \lst@lineno>\lst@lastline%
    \lst@GetNextLineInterval%
    \expandafter\lst@next%
  \else%
    \@tempcnta\lst@gobble\relax%
    \expandafter\lst@BOLGobble%
  \fi}%
\endgroup
\lst@AddToHook{EOL}{}% init
\def\lst@GetNextLineInterval{%
  \ifx\lst@linerange\@empty
    \let\lst@next\lst@EndProcessListing
    \global\let\lst@DefRange\@empty
  \else
    \lst@interrange
    \lst@GetLineInterval
    \let\lst@next\lst@SkipToFirst
  \fi}
\def\lst@GetLineInterval{\expandafter\lst@GLI\lst@linerange\@nil}
\def\lst@GLI#1,#2\@nil{%
  \def\lst@linerange{#2}%
  \lstKV@ReadArgs-{\lst@firstline\lst@lastline}{#1-\@nnil}%
  \lst@IfNumbers\lst@firstline\lst@lastline
  {\ifx\lst@firstline\@empty \def\lst@firstline{1}\fi
   \ifx\lst@lastline\@empty
     \def\lst@lastline{9999999}%
   \else
     \expandafter\ifx\expandafter\@nnil\lst@lastline
       \let\lst@lastline\lst@firstline
     \fi
   \fi
   \edef\lst@firstline{\lst@firstline\relax}%
   \edef\lst@lastline{\lst@lastline\relax}%
  }{%
          \let\lst@rangebegin\lst@rangebeginprefix
   \lst@eAddTo\lst@rangebegin\lst@firstline
   \lst@eAddTo\lst@rangebegin\lst@rangebeginsuffix
   \ifx\lst@lastline\@empty
     \let\lst@rangeend\@empty
   \else
     \let\lst@rangeend\lst@rangeendprefix
     \expandafter\ifx\expandafter\@nnil\lst@lastline
       \lst@eAddTo\lst@rangeend\lst@firstline
     \else
       \lst@eAddTo\lst@rangeend\lst@lastline
     \fi
     \lst@eAddTo\lst@rangeend\lst@rangeendsuffix
   \fi
   \ifx\lst@rangebegin\@empty
     \let\lst@firstline\@ne
     \global\let\lst@DefRange\lst@DefRangeEnd
   \else
     \let\lst@firstline\maxdimen
     \global\let\lst@DefRange\lst@DefRangeBegin
   \fi
   \let\lst@lastline\maxdimen}}
\def\lst@DefRangeBegin{\expandafter\lst@CArg\lst@rangebegin\relax\lst@RangeB}
\def\lst@RangeB#1#2{\lst@RangeB@#1#2}
\def\lst@RangeB@#1#2#3#4{%
  \def\lst@RangeBegin{%
      \lst@IfNextChars{#2#3}%
      {\global\let\lst@DefRange\lst@DefRangeEnd
       \lst@ifincluderangemarker
         \lst@LeaveMode
         \lsthk@BeginPart \lst@Let{`#1}#4\lst@DefRangeEnd
         \def\lst@next{\lst@ScanNextChar#1#2#3}%
         \expandafter\lst@next
       \else
         \@tempcnta\lst@lineno \advance\@tempcnta\@ne
         \edef\lst@firstline{\the\@tempcnta\relax}%
         \lst@Let{`#1}#4%
         \lst@Pop\lst@modestack
         \lst@AddToStackItem{\lst@DefRangeEnd}%
         \lst@Push\lst@modestack
         \expandafter\lst@ScanNextChar
       \fi}%
      {\ifx #4\lst@EndDropInputChar
         \let\lst@next#4%
       \else
         \let\lst@next\lst@ScanNextChar
       \fi
       \expandafter\lst@next\lst@eaten}}%
  \lst@RegisterEndDropInputChar{`#1}#4\lst@RangeBegin}
\def\lst@DefRangeEnd{%
  \ifx\lst@rangeend\@empty\else
    \expandafter\lst@CArg\lst@rangeend\relax\lst@RangeE
  \fi}
\def\lst@RangeE#1#2{\lst@RangeE@#1#2}
\def\lst@RangeE@#1#2#3#4{%
  \lst@Def{`#1}{%
      \lst@IfNextChars{#2#3}%
      {\lst@ifincluderangemarker
         #4#2#3^^@\lst@OutputTokenStream
         \lst@ResetTokenStream \lsthk@EOL
       \fi
       \lst@Let{`#1}#4%
       \lst@LeaveModeTo\lst@Pmode
       \lst@GetNextLineInterval
       \expandafter\lst@DefRange
       \lst@next}%
      {\expandafter#4\lst@eaten}}}
\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}%
                            \def\lst@rangeendprefix{#1}}
\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}%
                            \def\lst@rangeendsuffix{#1}}
\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}}
\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}}
\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}}
\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}}
\lst@Key{includerangemarker}{t}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker}
\def\lst@IfNumbers#1#2{%
  \let\lst@next\@firstoftwo
  \ifx\@empty#1\else
    \expandafter\expandafter\expandafter\lst@IfNumber@#1\@nil
  \fi
  \ifx\@empty#2\else
    \expandafter\expandafter\expandafter\lst@IfNumber@#2\@nil
  \fi
  \lst@next}
\def\lst@IfNumber@#1#2\@nil{%
  \ifnum`#1<48\relax \let\lst@next\@secondoftwo \else
  \ifnum`#1>57\relax \let\lst@next\@secondoftwo
  \fi\fi}
\def\lst@DroppedWarning{%
  \ifx\lst@dropped\@undefined\else
    \PackageWarning{Listings}{Text dropped after begin of listing}%
  \fi}
\let\lst@dropped\@undefined % init
\begingroup \lccode`\~=`\^^M\lowercase{%
\gdef\lst@ProcessEnv#1{%
  \ifx~#1%
    \lst@DroppedWarning \let\lst@next\lst@ProcessEnvM
  \else\ifx^^J#1%
    \lst@DroppedWarning \let\lst@next\lst@ProcessEnvJ
  \else
    \let\lst@dropped#1\let\lst@next\lst@ProcessEnv
  \fi \fi
  \lst@next}%
}\endgroup
\def\lst@ProcessEnvJ{%
  \@tempcnta\lst@gobble \advance\@tempcnta\@ne
  \edef\lst@gobble{\the\@tempcnta}%
  \def\lst@arg{ }%
  \ifx\@currenvir\lst@envname
    \expandafter\lst@ProcessEnvJEnv
  \else
    \expandafter\def\expandafter\lst@temp\expandafter##\expandafter1%
                                         \csname end\lst@envname\endcsname
        {\lst@InsideConvert{##1}\lst@ProcessEnvScan}%
    \expandafter\lst@temp
  \fi}
\def\lst@ProcessEnvJEnv#1\end#2{%
  \def\lst@temp{#2}%
  \ifx\lst@envname\lst@temp
    \lst@InsideConvert{#1}%
    \expandafter\lst@ProcessEnvScan
  \else
    \lst@InsideConvert{#1\end{#2}}%
    \expandafter\lst@ProcessEnvJEnv
  \fi}
\def\lst@ProcessEnvM{%
  \ifx\@currenvir\lst@envname
    \begingroup\lccode`\/=\escapechar\lccode`\[=`\{\lccode`\]=`\}%
    \lowercase{\endgroup
      \edef\lst@temp{/end[\lst@envname]}}%
  \else
    \begingroup\lccode`\/=\escapechar\lowercase{\endgroup
    \edef\lst@temp{/end\lst@envname}}%
  \fi
  \expandafter\def\expandafter\lst@temp\expandafter##\expandafter1\lst@temp
      {\def\lst@arg{##1}\lst@ProcessEnvScan}%
  \lst@temp}
\def\lst@ProcessEnvScan{%
  \lst@ifprocessdisplay
    \expandafter\lst@SkipToFirst\lst@arg^^@%
  \fi
  \lst@ProcessEnvEnd}
\def\lst@ProcessEnvEnd{%
  \ifx\@currenvir\lst@envname
    \edef\lst@next{\noexpand\end{\lst@envname}}%
  \else
    \def\lst@next{\csname end\lst@envname\endcsname}%
  \fi
  \lst@next}
\lst@UserCommand\lstnewenvironment#1#2#{%
  \@ifundefined{#1}%
  {\lstnewenvironment@{#1}{#1}{#2}}%
  {\lst@Error{Environment `#1' already defined}\@eha
   \@gobbletwo}}
\def\lstnewenvironment@#1#2#3#4#5{%
  \begingroup
  \global\@namedef{end#2}{\lst@Error{Extra \string\end#2}\@eha}%
  \global\@namedef{#2}{\def\lst@envname{#2}%
      \bgroup \lst@setcatcodes \catcode\active=\active
      \csname#2@\endcsname}%
  \let\l@ngrel@x\global
  \let\@xargdef\lstenv@xargdef
  \expandafter\new@command\csname#2@\endcsname#3%
      {\let\lst@insertargs\@empty
       \lsthk@PreSet #4%
       \@namedef{end#2}{\lst@ExitDisplay #5\egroup
                        \@doendpe \@ignoretrue}%
       \def\lst@EndProcessListing####1^^@{}%
       \lst@InitDisplay
       \expandafter\lst@ProcessEnv\lst@insertargs}%
  \endgroup}%
\def\lstenv@xargdef#1{
  \expandafter\lstenv@xargdef@\csname\string#1\endcsname#1}
\def\lstenv@xargdef@#1#2[#3][#4]#5{%
  \@ifdefinable#2%
  {\gdef#2{\ifx\protect\@typeset@protect \expandafter\lstenv@testopt
                                   \else \@x@protect#2\fi
           #1{#4}}%
   \@yargdef#1\tw@{#3}{#5}}}
\long\def\lstenv@testopt#1#2{%
  \@ifnextchar[{\catcode\active10\relax \lstenv@testopt@#1}%
               {#1[{#2}]}}
\def\lstenv@testopt@#1[#2]{\catcode\active\active #1[#2]}
\lstnewenvironment{lstlisting}[2][]
    {\lst@TestEOLChar{#2}%
     \lstsetup{#1}%
     \lst@SetFirstNumber}
    {\lst@SaveFirstNumber}
\begingroup \lccode`\~=`\^^M\lowercase{%
\gdef\lst@TestEOLChar#1{%
  \def\lst@insertargs{#1}%
  \ifx ~#1\@empty \else
  \ifx^^J#1\@empty \else
    \global\let\lst@intname\lst@insertargs
    \let\lst@insertargs\@empty
  \fi \fi}
}\endgroup
\def\lst@SetFirstNumber{%
  \ifx\lst@firstnumber\lst@undefined
    \ifcsname lstno@\lst@intname\endcsname
      \edef\lst@firstnumber{%
          \the\numexpr \csname lstno@\lst@intname\endcsname\relax}%
      \lst@nololtrue
    \fi
  \fi}%
\def\lst@SaveFirstNumber{%
  \expandafter\xdef
  \csname lstno\ifx\lst@intname\@empty @ \else @\lst@intname\fi\endcsname
      {\the\c@lstnumber}}
\def\lst@MakePath#1{\ifx\@empty#1\@empty\else\lst@MakePath@#1/\@nnil/\fi}
\def\lst@MakePath@#1/{#1/\lst@MakePath@@}
\def\lst@MakePath@@#1/{%
  \ifx\@nnil#1\expandafter\@gobble
        \else \ifx\@empty#1\else #1/\fi \fi
  \lst@MakePath@@}
\lst@Key{inputpath}{}{\edef\lst@inputpath{\lst@MakePath{#1}}}
\def\lstinputlisting{%
  \begingroup \lst@setcatcodes \lst@inputlisting}
\newcommand\lst@inputlisting[2][]{%
  \endgroup
  \def\lst@set{#1}%
  \IfFileExists{\lst@inputpath#2}%
  {\expandafter\lst@InputListing\expandafter{\lst@inputpath#2}}%
  {\filename@parse{\lst@inputpath#2}%
   \edef\reserved@a{\noexpand\lst@MissingFileError
       {\filename@area\filename@base}%
       {\ifx\filename@ext\relax tex\else\filename@ext\fi}}%
   \reserved@a}%
  \@doendpe \@newlistfalse \ignorespaces}
\def\lst@MissingFileError#1#2{%
  \typeout{^^J! Package Listings Error: File `#1(.#2)' not found.^^J%
           ^^JType X to quit or <RETURN> to proceed,%
           ^^Jor enter new name. (Default extension: #2)^^J}%
  \message{Enter file name: }%
  {\endlinechar\m@ne \global\read\m@ne to\@gtempa}%
  \ifx\@gtempa\@empty \else
    \def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi
    \def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi
    \filename@parse\@gtempa
    \edef\filename@ext{\ifx\filename@ext\relax#2\else\filename@ext\fi}%
    \edef\reserved@a{%
      \noexpand\IfFileExists{\filename@area\filename@base.\filename@ext}%
      {\noexpand\lst@InputListing{\filename@area\filename@base.\filename@ext}}%
      {\noexpand\lst@MissingFileError
          {\filename@area\filename@base}{\filename@ext}}}%
    \expandafter\reserved@a
  \fi}
\def\lst@InputListing#1{%
  \begingroup
  \let\lst@inputfile\@filef@und
  \lsthk@PreSet \gdef\lst@intname{#1}%
  \expandafter\lstsetup\expandafter{\lst@set}%
  \lst@InitDisplay \let\lst@gobble\z@
  \lst@ifprocessdisplay
    \@addtofilelist{#1}%
    \def\lst@next{\everyeof{^^@}%
                  \expandafter\lst@SkipToFirst\@@input\lst@inputfile}%
    \expandafter\lst@next
  \fi
  \lst@ExitDisplay
  \endgroup}
\let\lst@EndProcessListing\endinput
\lst@Key{aboveskip}\medskipamount{\def\lst@aboveskip{#1}}
\lst@Key{belowskip}\medskipamount{\def\lst@belowskip{#1}}
\lst@Key{box}{false}[t]{\lstKV@SetIf{#1}\lst@ifbox}
\lst@AddToHook{PreSet}{\let\lst@ifbox\iffalse}
\def\lst@boxtrue{\let\lst@ifbox\iftrue}
\def\lst@InitDisplay{%
  \ifx\lst@float\relax
    \ifhmode\ifinner \lst@boxtrue \else \par \fi\fi
  \fi
  \lst@ifbox
    \expandafter\hbox\expandafter\bgroup\expandafter\lsthk@BoxUnsafe
  \fi
  \let\lst@roomleft\maxdimen
  \ifx\lst@float\relax
    \ifvmode
      \allowbreak \vskip\lst@aboveskip \goodbreak
      \ifinner\else \def\lst@roomleft{\@colroom-\pagetotal}\fi
    \fi
  \fi
  \normalbaselines
  \lsthk@Init \lsthk@InitVars
  \lsthk@InitVarsDisplay \lsthk@InitDisplay
  \lst@SetTBBox\lst@topbox{\lst@MakeCaption t}%
  \lst@SetTBBox\lst@finalbox{\lst@MakeCaption b}%
  \lst@SetTBBox\lst@botbox{}%
  \lst@basicstyle
  \lst@EnterMode{\lst@Pmode}{}%
  \lst@SelectCharTable
  \lsthk@InitVarsBOL\lsthk@InitScanBOL}
\def\lst@ExitDisplay{%
  \lst@eolistingtrue \lst@OutputTokenStream
  \ifx\lst@float\relax
    \ifvmode
      \goodbreak \vskip\lst@belowskip \allowbreak
    \fi
  \fi
  \lst@ifbox \expandafter\egroup \fi
  \lsthk@ExitDisplay}
\lst@AddToHook{ExitDisplay}{}% init
\def\lst@SetTBBox#1#2{%
  \setbox#1\vbox{#2}%
  \ifdim \dimexpr\ht#1+\dp#1=\z@
    \setbox#1\box\voidb@x
  \fi}
\newbox\lst@topbox
\newbox\lst@finalbox
\newbox\lst@botbox
\lst@Key{listingname}{Listing}{\def\lstlistingname{#1}}
\lst@Key{numberby}\relax{%
  \@ifundefined{the#1}{\lst@Error{Undefined \string\the#1}\@eha}%
                      {\def\lst@numberby{#1}%
                       \KV@lst@resetby{#1}}}
\lst@Key{resetby}\relax{%
  \@ifundefined{c@#1}{\lst@Error{Undefined counter #1}\@eha}%
                     {\def\lst@resetby{#1}}}
\lst@Key{numberbychapter}\relax[t]{%
  \lstKV@SetIf{#1}\lst@if
  \lst@if \KV@lst@numberby{chapter}\else
    \let\lst@numberby\@empty \let\lst@resetby\@empty
  \fi}
\@ifundefined{thechapter}{\let\lst@numberby\@empty \let\lst@resetby\@empty}%
                         {\KV@lst@numberby{chapter}}% init
\AtBeginDocument{%
  \ifx\lst@resetby\@empty \newcounter{lstlisting}%
                    \else \newcounter{lstlisting}[\lst@resetby]\fi
  \ifx\lst@numberby\@empty
    \gdef\thelstlisting{\@arabic\c@lstlisting}%
  \else
    \xdef\thelstlisting
      {\noexpand\ifnum\expandafter\noexpand\csname c@\lst@numberby\endcsname>\z@
         \expandafter\noexpand\csname the\lst@numberby\endcsname.%
       \noexpand\fi
       \noexpand\@arabic\noexpand\c@lstlisting}%
  \fi
  \let\lst@numberby\@empty \let\lst@resetby\@empty
  \let\KV@lst@numberby\@gobble \let\KV@lst@resetby\@gobble}
\lst@AddToHook{InitDisplay}%
  {\ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else
                           \expandafter\refstepcounter
   \fi {lstlisting}%
   \ifx\lst@label\@empty\else \label{\lst@label}\fi}
\lst@Key{label}{}{\def\lst@label{#1}}
\def\lst@HRefStepCounter#1{%
  \begingroup
  \c@lstlisting\lst@neglisting
  \advance\c@lstlisting\m@ne \xdef\lst@neglisting{\the\c@lstlisting}%
  \ifx\hyper@refstepcounter\@undefined\else
    \hyper@refstepcounter{#1}%
  \fi
  \endgroup}
\gdef\lst@neglisting{\z@}% init
\@ifundefined{abovecaptionskip}%
{\newskip\abovecaptionskip
 \newskip\belowcaptionskip}{}%
\lst@Key{abovecaptionskip}\smallskipamount{\def\lst@abovecaption{#1}}
\lst@Key{belowcaptionskip}\smallskipamount{\def\lst@belowcaption{#1}}
\lst@AddToHook{InitDisplay}%
  {\abovecaptionskip\lst@abovecaption\relax
   \belowcaptionskip\lst@belowcaption\relax}
\lst@Key{title}\relax{%
  \def\lst@title{#1}\let\lst@caption\relax \let\lst@@caption\@empty}
\lst@Key{caption}{}{\lstKV@OArg[{#1}]{#1}%
  {\def\lst@caption{##2}\def\lst@@caption{##1}}%
   \let\lst@title\@empty}
\lst@Key{captionpos}{t}{\def\lst@captionpos{#1}}
\@ifundefined{@makecaption}
{\long\def\@makecaption#1#2{%
   \vskip\abovecaptionskip
   \sbox\@tempboxa{#1: #2}%
   \ifdim \wd\@tempboxa >\hsize
     #1: #2\par
   \else
     \global \@minipagefalse
     \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
   \fi
   \vskip\belowcaptionskip}%
}{}
\def\fnum@lstlisting{%
  \lstlistingname
  \ifx\lst@@caption\@empty\else~\thelstlisting\fi}%
\def\lst@MakeCaption#1{%
  \ifx\lst@caption\@empty\else
    \lst@IfSubstring #1\lst@captionpos
    {\par\@parboxrestore\normalsize\normalfont % \noindent (AS)
     \vbox{\ifx\lst@title\@empty
             \lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption}
           \else
             \lst@maketitle\lst@title % (AS)
           \fi}}%
    {}%
  \fi}
\def\lst@makecaption{\@makecaption}
\def\lst@maketitle{\@makecaption\lst@title@dropdelim}
\def\lst@title@dropdelim#1{\ignorespaces}
\AtBeginDocument{%
\@ifundefined{captionlabelfalse}{}{%
  \def\lst@maketitle{\captionlabelfalse\@makecaption\@empty}}%
\@ifundefined{caption@startrue}{}{%
  \def\lst@maketitle{\caption@startrue\@makecaption\@empty}}%
}
\lst@Key{name}\relax{\def\lst@intname{#1}}
\lst@AddToHook{PreSet}{\global\let\lst@intname\@empty}
\lst@AddToHook{InitDisplay}%
  {\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl
   \global\let\lst@name\lst@arg \global\let\lstname\lst@name}
\def\lst@filenamerpl{_\textunderscore $\textdollar -\textendash}
\global\let\lst@intname\@empty % init
\lst@Key{listlistingname}{Listings}{\def\lstlistlistingname{#1}}
\lst@Key{nolol}{false}[t]{\lstKV@SetIf{#1}\lst@ifnolol}
\def\lst@nololtrue{\let\lst@ifnolol\iftrue}
\let\lst@ifnolol\iffalse % init
\lst@AddToHook{InitDisplay}%
  {\lst@ifnolol\else
     \ifx\lst@@caption\@empty
       \ifx\lst@caption\@empty
         \ifx\lst@intname\@empty\else \def\lst@temp{ }%
         \ifx\lst@intname\lst@temp\else
           \addcontentsline{lol}{lstlisting}\lst@name
         \fi\fi
       \fi
     \else
       \addcontentsline{lol}{lstlisting}%
           {\protect\numberline{\thelstlisting}\lst@@caption}%
     \fi
   \fi}
\def\l@lstlisting#1#2{\@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}}
\lst@UserCommand\lstlistoflistings{\bgroup
    \let\contentsname\lstlistlistingname
    \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
    \tableofcontents \egroup}
\@ifundefined{float@listhead}{}{%
  \renewcommand*{\lstlistoflistings}{%
    \begingroup
      \@ifundefined{@restonecoltrue}{}{%
        \if@twocolumn
          \@restonecoltrue\onecolumn
        \else
          \@restonecolfalse
        \fi
      }%
      \float@listhead{\lstlistlistingname}%
      \parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil%
      \@starttoc{lol}%
      \@ifundefined{@restonecoltrue}{}{%
        \if@restonecol\twocolumn\fi
      }%
    \endgroup
  }%
}
\AtBeginDocument{%
  \@ifundefined{float@addtolists}%
    {\gdef\float@addtolists#1{\addtocontents{lol}{#1}}}%
    {\let\orig@float@addtolists\float@addtolists
     \gdef\float@addtolists#1{%
       \addtocontents{lol}{#1}%
       \orig@float@addtolists{#1}}}%
}%
\lst@Key{fancyvrb}\relax[t]{%
  \lstKV@SetIf{#1}\lst@iffancyvrb
  \lst@Fancyvrb}
\ifx\lst@Fancyvrb\@undefined
  \gdef\lst@Fancyvrb{\lst@RequireAspects{fancyvrb}\lst@Fancyvrb}
\fi
\lst@Key{extendedchars}\relax[t]{}
\lst@Key{alsoletter}\relax{\KV@lst@morecharclass{[i]#1}}
\lst@Key{alsodigit}\relax{\KV@lst@morecharclass{[d]#1}}
\lst@Key{alsoother}\relax{\KV@lst@morecharclass{[m]#1}}
\lst@Key{showtokens}{false}[t]{\lstKV@SetIf{#1}\lst@ifshowtokens}
\lst@AddToHook{Init}{%
  \lst@ifshowtokens
    \fboxsep\z@ \let\lst@alloverstyle\lst@showtokens
  \fi}
\def\lst@showtokens#1{\fbox{\strut#1}}
\lst@Key{literate}\relax{%
  \ifx\KV@lst@transcribe\lst@undefined \lst@RequireAspects{transcribe}\fi
  \KV@lst@transcribe{}%
  \lst@Literate#1{}\relax\z@}
\def\lst@Literate#1#2#3{%
  \ifx\relax#2\@empty\else
    \KV@lst@moretranscribe{{#1}{#2}{#3}}%
    \expandafter\lst@Literate
  \fi}
\let\lstset\lstsetup
\DeclareOption{savemem}
  {\PackageWarning{Listings}{Option `savemem' is not available anymore}}
\lst@Info\@ne{kernel loaded}
\DeclareOption{draft}{\let\lst@ifprocessdisplay\iffalse}
\DeclareOption{final}{\let\lst@ifprocessdisplay\iftrue}
\DeclareOption{noaspects}{\let\lst@loadaspects\@empty}
\DeclareOption*{\expandafter\lst@ProcessOption\CurrentOption\relax}
\def\lst@ProcessOption#1#2\relax{%
  \ifx #1!%
    \lst@RemoveFromList\lst@loadaspects{#2}%
  \else
    \lst@lAddTo\lst@loadaspects{,#1#2}%
  \fi}
\@ifundefined{lst@loadaspects}
{\@ifpackageloaded{xkeyval}%
 {\def\lst@loadaspects{style,language}}% TODO: load strings,comments,keywords?
 {\def\lst@loadaspects{strings,comments,keywords,emph,index,escape,%
      style,language,frames}}%
}{}
\InputIfFileExists{lst2patch.sty}{%
\lst@Info\@ne{applying patch file}
}{}
\lst@Info\@ne{processing options}
\ProcessOptions
\lst@RequireAspects\lst@loadaspects
\let\lst@loadaspects\@empty
\lst@UseHook{SetStyle}\lst@UseHook{EmptyStyle}
\lst@UseHook{SetLanguage}\lst@UseHook{EmptyLanguage}
\lst@Info\@ne{loading and applying configuration}
\InputIfFileExists{listings2.cfg}{}{}
\InputIfFileExists{lstlocal2.cfg}{}{}
\lst@for\lst@loadedaspects\do
{\ifcsname lstconfig@#1\endcsname
   \csname lstconfig@#1\endcsname
   \global\expandafter\let\csname lstconfig@#1\endcsname\lst@undefined
 \fi}
\lst@ReportAllocs
\endinput
%%
%% End of file `listings2.sty'.
